Print this page
1150 libcmdutils has superfluous #define
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Marcel Telka <marcel@telka.sk>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libcmdutils/libcmdutils.h
+++ new/usr/src/lib/libcmdutils/libcmdutils.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25 /*
26 26 * Copyright (c) 2013 RackTop Systems.
27 27 */
28 28 /*
29 29 * Copyright 2014 Joyent, Inc.
30 30 */
31 31
32 32 /*
33 33 * Declarations for the functions in libcmdutils.
34 34 */
35 35
36 36 #ifndef _LIBCMDUTILS_H
37 37 #define _LIBCMDUTILS_H
38 38
39 39 /*
40 40 * This is a private header file. Applications should not directly include
41 41 * this file.
42 42 */
43 43
44 44 #include <stdio.h>
45 45 #include <unistd.h>
46 46 #include <stdlib.h>
47 47 #include <errno.h>
48 48 #include <fcntl.h>
49 49 #include <limits.h>
50 50 #include <libintl.h>
51 51 #include <string.h>
52 52 #include <dirent.h>
53 53 #include <attr.h>
54 54 #include <sys/avl.h>
55 55 #include <sys/types.h>
56 56 #include <sys/stat.h>
57 57 #include <sys/mman.h>
58 58 #include <libnvpair.h>
59 59
60 60 #ifdef __cplusplus
↓ open down ↓ |
60 lines elided |
↑ open up ↑ |
61 61 extern "C" {
62 62 #endif
63 63
64 64 /* extended system attribute support */
65 65 #define _NOT_SATTR 0
66 66 #define _RO_SATTR 1
67 67 #define _RW_SATTR 2
68 68
69 69 #define MAXMAPSIZE (1024*1024*8) /* map at most 8MB */
70 70 #define SMALLFILESIZE (32*1024) /* don't use mmap on little file */
71 -#define ISREG(A) (((A).st_mode & S_IFMT) == S_IFREG)
72 71
73 72 /* avltree */
74 73 #define OFFSETOF(s, m) ((size_t)(&(((s *)0)->m)))
75 74
76 75 /* Type used for a node containing a device id and inode number */
77 76 typedef struct tree_node {
78 77 dev_t node_dev;
79 78 ino_t node_ino;
80 79 avl_node_t avl_link;
81 80 } tree_node_t;
82 81
83 82
84 83 /* extended system attribute support */
85 84
86 85 /* Determine if a file is the name of an extended system attribute file */
87 86 extern int sysattr_type(char *);
88 87
89 88 /* Determine if the underlying file system supports system attributes */
90 89 extern int sysattr_support(char *, int);
91 90
92 91 /* Copies the content of the source file to the target file */
93 92 extern int writefile(int, int, char *, char *, char *, char *,
94 93 struct stat *, struct stat *);
95 94
96 95 /* Gets file descriptors of the source and target attribute files */
97 96 extern int get_attrdirs(int, int, char *, int *, int *);
98 97
99 98 /* Move extended attribute and extended system attribute */
100 99 extern int mv_xattrs(char *, char *, char *, int, int);
101 100
102 101 /* Returns non default extended system attribute list */
103 102 extern nvlist_t *sysattr_list(char *, int, char *);
104 103
105 104
106 105
107 106 /* avltree */
108 107
109 108 /*
110 109 * Used to compare two nodes. We are attempting to match the 1st
111 110 * argument (node) against the 2nd argument (a node which
112 111 * is already in the search tree).
113 112 */
114 113
115 114 extern int tnode_compare(const void *, const void *);
116 115
117 116 /*
118 117 * Used to add a single node (containing the input device id and
119 118 * inode number) to the specified search tree. The calling
120 119 * application must set the tree pointer to NULL before calling
121 120 * add_tnode() for the first time.
122 121 */
123 122 extern int add_tnode(avl_tree_t **, dev_t, ino_t);
124 123
125 124 /*
126 125 * Used to destroy a whole tree (all nodes) without rebalancing.
127 126 * The calling application is responsible for setting the tree
128 127 * pointer to NULL upon return.
129 128 */
130 129 extern void destroy_tree(avl_tree_t *);
131 130
132 131
133 132
134 133 /* user/group id helpers */
135 134
136 135 /*
137 136 * Used to get the next available user id in given range.
138 137 */
139 138 extern int findnextuid(uid_t, uid_t, uid_t *);
140 139
141 140 /*
142 141 * Used to get the next available group id in given range.
143 142 */
144 143 extern int findnextgid(gid_t, gid_t, gid_t *);
145 144
146 145
147 146
148 147 /* dynamic string utilities */
149 148
150 149 typedef struct custr custr_t;
151 150
152 151 /*
153 152 * Allocate and free a "custr_t" dynamic string object. Returns 0 on success
154 153 * and -1 otherwise.
155 154 */
156 155 extern int custr_alloc(custr_t **);
157 156 extern void custr_free(custr_t *);
158 157
159 158 /*
160 159 * Append a single character, or a NUL-terminated string of characters, to a
161 160 * dynamic string. Returns 0 on success and -1 otherwise. The dynamic string
162 161 * will be unmodified if the function returns -1.
163 162 */
164 163 extern int custr_appendc(custr_t *, char);
165 164 extern int custr_append(custr_t *, const char *);
166 165
167 166 /*
168 167 * Determine the length in bytes, not including the NUL terminator, of the
169 168 * dynamic string.
170 169 */
171 170 extern size_t custr_len(custr_t *);
172 171
173 172 /*
174 173 * Clear the contents of a dynamic string. Does not free the underlying
175 174 * memory.
176 175 */
177 176 extern void custr_reset(custr_t *);
178 177
179 178 /*
180 179 * Retrieve a const pointer to a NUL-terminated string version of the contents
181 180 * of the dynamic string. Storage for this string should not be freed, and
182 181 * the pointer will be invalidated by any mutations to the dynamic string.
183 182 */
184 183 extern const char *custr_cstr(custr_t *str);
185 184
186 185 #ifdef __cplusplus
187 186 }
188 187 #endif
189 188
190 189 #endif /* _LIBCMDUTILS_H */
↓ open down ↓ |
109 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX