2 commits - xlators/features
Jeff Darcy
jdarcy at fedoraproject.org
Thu Jun 9 02:01:47 UTC 2011
xlators/features/uidmap/src/rbmap.c | 14
xlators/features/uidmap/src/uidmap.c | 2617 +++++++++++++++++------------------
2 files changed, 1347 insertions(+), 1284 deletions(-)
New commits:
commit 08d79e2084424ab4cdd7deb29be0e9d89d0f1e96
Author: Jeff Darcy <jdarcy at redhat.com>
Date: Wed Jun 8 21:57:53 2011 -0400
Map UID/GID 0 regardless of root_squash.
Clients should never ever be able to "escape" into the server's own UID/GID
space, especially not for UID/GID 0. Also, the UID and GID should be
mapped (to CLOUDFS_NOBODY) separately when root_squash is set, because they
might not be zero at the same times.
diff --git a/xlators/features/uidmap/src/rbmap.c b/xlators/features/uidmap/src/rbmap.c
index 49b3500..030cac5 100644
--- a/xlators/features/uidmap/src/rbmap.c
+++ b/xlators/features/uidmap/src/rbmap.c
@@ -288,13 +288,12 @@ map(struct _call_stack_t *stack, char *name)
if (mapping == NULL) {
return -1;
}
- if (stack->uid == 0 && mapping->root_squash) {
- stack->uid = stack->gid = CLOUDFS_NOBODY;
- return 0;
- }
do {
pthread_mutex_lock(&mapping->mtx);
- if (stack->uid != 0) {
+ if (stack->uid == 0 && mapping->root_squash) {
+ stack->uid = CLOUDFS_NOBODY;
+ }
+ else {
/* look for an existing match */
union tuple *new_map, tneedle;
tneedle.u1 = stack->uid;
@@ -347,7 +346,10 @@ map(struct _call_stack_t *stack, char *name)
}
stack->uid = new_map->u2;
}
- if (stack->gid != 0) {
+ if (stack->gid == 0 && mapping->root_squash) {
+ stack->gid = CLOUDFS_NOBODY;
+ }
+ else {
/* look for an existing match */
union tuple *new_map, tneedle;
tneedle.g1 = stack->gid;
commit 680bd6c453664f4e6ae9cbc16f9ac7f9d0220e18
Author: Jeff Darcy <jdarcy at redhat.com>
Date: Wed Jun 8 21:34:18 2011 -0400
Fix style issues
Indentation, assignment within conditional, braces and parens, etc.
diff --git a/xlators/features/uidmap/src/uidmap.c b/xlators/features/uidmap/src/uidmap.c
index 550314f..72d03f1 100644
--- a/xlators/features/uidmap/src/uidmap.c
+++ b/xlators/features/uidmap/src/uidmap.c
@@ -40,47 +40,47 @@
#define CFS_GID_HIGH_DEFAULT 19999
typedef struct uid_map_entry {
- uid_t me_client_uid;
- uid_t me_server_uid;
+ uid_t me_client_uid;
+ uid_t me_server_uid;
} uid_map_entry_t;
typedef struct gid_map_entry {
- uid_t me_client_gid;
- uid_t me_server_gid;
+ uid_t me_client_gid;
+ uid_t me_server_gid;
} gid_map_entry_t;
typedef struct {
- char *name;
- uid_map_entry_t *uid_map;
- unsigned short uid_map_len;
- uid_t uid_low;
- uid_t uid_high;
- uid_t uid_next;
- gid_map_entry_t *gid_map;
- unsigned short gid_map_len;
- gid_t gid_low;
- gid_t gid_high;
- gid_t gid_next;
- short root_squash;
- pthread_mutex_t mtx;
+ char *name;
+ uid_map_entry_t *uid_map;
+ unsigned short uid_map_len;
+ uid_t uid_low;
+ uid_t uid_high;
+ uid_t uid_next;
+ gid_map_entry_t *gid_map;
+ unsigned short gid_map_len;
+ gid_t gid_low;
+ gid_t gid_high;
+ gid_t gid_next;
+ short root_squash;
+ pthread_mutex_t mtx;
} mapping_t;
static unsigned short uidmap_num_mappings = 0;
static mapping_t* uidmap_mappings; /* = {
- .im_name = NULL,
- .im_uid_map = NULL,
- .im_uid_map_len = 0,
- .im_uid_low = CFS_UID_LOW_DEFAULT,
- .im_uid_high = CFS_UID_HIGH_DEFAULT,
- .im_uid_next = CFS_UID_LOW_DEFAULT,
- .im_gid_map = NULL,
- .im_gid_map_len = 0,
- .im_gid_low = CFS_UID_LOW_DEFAULT,
- .im_gid_high = CFS_UID_HIGH_DEFAULT,
- .im_gid_next = CFS_UID_LOW_DEFAULT,
- .im_root_squash = 0,
- .im_mtx = PTHREAD_MUTEX_INITIALIZER
+ .im_name = NULL,
+ .im_uid_map = NULL,
+ .im_uid_map_len = 0,
+ .im_uid_low = CFS_UID_LOW_DEFAULT,
+ .im_uid_high = CFS_UID_HIGH_DEFAULT,
+ .im_uid_next = CFS_UID_LOW_DEFAULT,
+ .im_gid_map = NULL,
+ .im_gid_map_len = 0,
+ .im_gid_low = CFS_UID_LOW_DEFAULT,
+ .im_gid_high = CFS_UID_HIGH_DEFAULT,
+ .im_gid_next = CFS_UID_LOW_DEFAULT,
+ .im_root_squash = 0,
+ .im_mtx = PTHREAD_MUTEX_INITIALIZER
}; */
#define CFS_SIGNATURE "cloudfs map: default\n"
@@ -107,374 +107,383 @@ static mapping_t* uidmap_mappings; /* = {
static void
uidmap_serialize_default(char *tenant, mapping_t *map)
{
- char fname[128], lkname[128];
- FILE *file = NULL;
- int lockfd = -1;
- (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, tenant);
- (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, tenant);
-
- do {
- int status;
- unsigned short i;
- lockfd = open(lkname, O_CREAT|O_WRONLY, 0644);
- if (lockfd == -1) {
- gf_log(tenant, GF_LOG_CRITICAL,
- "open %s: %s", lkname, strerror(errno));
- break;
- }
- status = flock(lockfd, LOCK_EX);
- if (status == -1) {
- gf_log(tenant, GF_LOG_CRITICAL,
- "flock failed %s", strerror(errno));
- break;
- }
- file = fopen(fname, "w");
- if (file == NULL) {
- (void) flock(lockfd, LOCK_UN);
- gf_log(tenant, GF_LOG_CRITICAL,
- "fopen failed %s", strerror(errno));
- break;
- }
- (void) fprintf(file, CFS_SIGNATURE);
- for (i = 0; i < map->uid_map_len; i++) {
- (void) fprintf(file, "%s %u %u\n",
- CFS_UID_MAP_ENTRY,
- map->uid_map[i].me_client_uid,
- map->uid_map[i].me_server_uid);
- }
- (void) fprintf(file, "%s %u\n",
- CFS_UID_LOW, map->uid_low);
- (void) fprintf(file, "%s %u\n",
- CFS_UID_HIGH, map->uid_high);
- (void) fprintf(file, "%s %u\n",
- CFS_UID_NEXT, map->uid_next);
- for (i = 0; i < map->gid_map_len; i++) {
- (void) fprintf(file, "%s %u %u\n", CFS_GID_MAP_ENTRY,
- map->gid_map[i].me_client_gid,
- map->gid_map[i].me_server_gid);
- }
- (void) fprintf(file, "%s %u\n", CFS_GID_LOW,
- map->gid_low);
- (void) fprintf(file, "%s %u\n", CFS_GID_HIGH,
- map->gid_high);
- (void) fprintf(file, "%s %u\n", CFS_GID_NEXT,
- map->gid_next);
- } while (0);
- if (file != NULL) {
- (void) fclose(file);
- }
- if (lockfd != -1) {
- (void) flock(lockfd, LOCK_UN);
- (void) close(lockfd);
- }
+ char fname[128], lkname[128];
+ FILE *file = NULL;
+ int lockfd = -1;
+ (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, tenant);
+ (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, tenant);
+
+ do {
+ int status;
+ unsigned short i;
+ lockfd = open(lkname, O_CREAT|O_WRONLY, 0644);
+ if (lockfd == -1) {
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "open %s: %s", lkname, strerror(errno));
+ break;
+ }
+ status = flock(lockfd, LOCK_EX);
+ if (status == -1) {
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "flock failed %s", strerror(errno));
+ break;
+ }
+ file = fopen(fname, "w");
+ if (file == NULL) {
+ (void) flock(lockfd, LOCK_UN);
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "fopen failed %s", strerror(errno));
+ break;
+ }
+ (void) fprintf(file, CFS_SIGNATURE);
+ for (i = 0; i < map->uid_map_len; i++) {
+ (void) fprintf(file, "%s %u %u\n",
+ CFS_UID_MAP_ENTRY,
+ map->uid_map[i].me_client_uid,
+ map->uid_map[i].me_server_uid);
+ }
+ (void) fprintf(file, "%s %u\n",
+ CFS_UID_LOW, map->uid_low);
+ (void) fprintf(file, "%s %u\n",
+ CFS_UID_HIGH, map->uid_high);
+ (void) fprintf(file, "%s %u\n",
+ CFS_UID_NEXT, map->uid_next);
+ for (i = 0; i < map->gid_map_len; i++) {
+ (void) fprintf(file, "%s %u %u\n", CFS_GID_MAP_ENTRY,
+ map->gid_map[i].me_client_gid,
+ map->gid_map[i].me_server_gid);
+ }
+ (void) fprintf(file, "%s %u\n", CFS_GID_LOW,
+ map->gid_low);
+ (void) fprintf(file, "%s %u\n", CFS_GID_HIGH,
+ map->gid_high);
+ (void) fprintf(file, "%s %u\n", CFS_GID_NEXT,
+ map->gid_next);
+ } while (0);
+ if (file != NULL) {
+ (void) fclose(file);
+ }
+ if (lockfd != -1) {
+ (void) flock(lockfd, LOCK_UN);
+ (void) close(lockfd);
+ }
}
static int
uidmap_adduidentry(mapping_t *map, uid_t server_uid, uid_t client_uid)
{
- uid_map_entry_t *uid_map_entry = NULL;
- map->uid_map = REALLOC(map->uid_map,
- sizeof(uid_map_entry_t) * (map->uid_map_len + 1));
- if (map->uid_map == NULL) {
- return -1;
- }
- uid_map_entry = &map->uid_map[map->uid_map_len++];
- uid_map_entry->me_client_uid = client_uid;
- uid_map_entry->me_server_uid = server_uid;
- return 0;
+ uid_map_entry_t *uid_map_entry = NULL;
+ map->uid_map = REALLOC(map->uid_map,
+ sizeof(uid_map_entry_t) * (map->uid_map_len + 1));
+ if (map->uid_map == NULL) {
+ return -1;
+ }
+ uid_map_entry = &map->uid_map[map->uid_map_len++];
+ uid_map_entry->me_client_uid = client_uid;
+ uid_map_entry->me_server_uid = server_uid;
+ return 0;
}
static int
uidmap_addgidentry(mapping_t *map, uid_t server_gid, uid_t client_gid)
{
- gid_map_entry_t *gid_map_entry = NULL;
- map->gid_map = REALLOC(map->gid_map,
- sizeof(gid_map_entry_t) * (map->gid_map_len + 1));
- if (map->gid_map == NULL) {
- return -1;
- }
- gid_map_entry = &map->gid_map[map->gid_map_len++];
- gid_map_entry->me_client_gid = client_gid;
- gid_map_entry->me_server_gid = server_gid;
- return 0;
+ gid_map_entry_t *gid_map_entry = NULL;
+ map->gid_map = REALLOC(map->gid_map,
+ sizeof(gid_map_entry_t) * (map->gid_map_len + 1));
+ if (map->gid_map == NULL) {
+ return -1;
+ }
+ gid_map_entry = &map->gid_map[map->gid_map_len++];
+ gid_map_entry->me_client_gid = client_gid;
+ gid_map_entry->me_server_gid = server_gid;
+ return 0;
}
static int
uidmap_readmapfile(mapping_t *map, FILE *file)
{
- char* sts;
- char scratch[128];
- while ((sts = fgets(scratch, sizeof scratch, file)) != (char *) EOF && sts != NULL) {
- if (strncmp(scratch, CFS_UID_MAP_ENTRY, CFS_UID_MAP_ENTRY_LEN) == 0) {
- uid_t server_uid;
- uid_t client_uid;
- int num = sscanf(&scratch[CFS_UID_MAP_ENTRY_LEN+1],
- " %u %u", &client_uid, &server_uid);
- if (num == 2) {
- if (uidmap_adduidentry(map, server_uid, client_uid) == -1) {
- return -1;
- }
- }
- } else if (strncmp(scratch, CFS_UID_LOW, CFS_UID_LOW_LEN) == 0) {
- map->uid_low = (uid_t) strtoul(&scratch[CFS_UID_LOW_LEN+1], NULL, 10);
- } else if (strncmp(scratch, CFS_UID_HIGH, CFS_UID_HIGH_LEN) == 0) {
- map->uid_high = (uid_t) strtoul(&scratch[CFS_UID_HIGH_LEN+1], NULL, 10);
- } else if (strncmp(scratch, CFS_UID_NEXT, CFS_UID_NEXT_LEN) == 0) {
- map->uid_next = (uid_t) strtoul(&scratch[CFS_UID_NEXT_LEN+1], NULL, 10);
- } else if (strncmp(scratch, CFS_GID_MAP_ENTRY, CFS_GID_MAP_ENTRY_LEN) == 0) {
- gid_t server_gid;
- gid_t client_gid;
- int num = sscanf(&scratch[CFS_GID_MAP_ENTRY_LEN+1],
- " %u %u", &client_gid, &server_gid);
- if (num == 2) {
- if (uidmap_addgidentry(map, server_gid, client_gid) == -1) {
- return -1;
- }
- }
- } else if (strncmp(scratch, CFS_GID_LOW, CFS_GID_LOW_LEN) == 0) {
- map->gid_low = (uid_t) strtoul(&scratch[CFS_GID_LOW_LEN+1], NULL, 10);
- } else if (strncmp(scratch, CFS_GID_HIGH, CFS_GID_HIGH_LEN) == 0) {
- map->gid_high = (uid_t) strtoul(&scratch[CFS_GID_HIGH_LEN+1], NULL, 10);
- } else if (strncmp(scratch, CFS_GID_NEXT, CFS_GID_NEXT_LEN) == 0) {
- map->gid_next = (uid_t) strtoul(&scratch[CFS_GID_NEXT_LEN+1], NULL, 10);
- }
- }
- return 0;
+ char* sts;
+ char scratch[128];
+
+ for (;;) {
+ sts = fgets(scratch, sizeof scratch, file);
+ if ((sts == (char *) EOF) || (sts != NULL)) {
+ break;
+ }
+ if (strncmp(scratch, CFS_UID_MAP_ENTRY, CFS_UID_MAP_ENTRY_LEN) == 0) {
+ uid_t server_uid;
+ uid_t client_uid;
+ int num = sscanf(&scratch[CFS_UID_MAP_ENTRY_LEN+1],
+ " %u %u", &client_uid, &server_uid);
+ if (num == 2) {
+ if (uidmap_adduidentry(map, server_uid, client_uid) == -1) {
+ return -1;
+ }
+ }
+ } else if (strncmp(scratch, CFS_UID_LOW, CFS_UID_LOW_LEN) == 0) {
+ map->uid_low = (uid_t) strtoul(&scratch[CFS_UID_LOW_LEN+1], NULL, 10);
+ } else if (strncmp(scratch, CFS_UID_HIGH, CFS_UID_HIGH_LEN) == 0) {
+ map->uid_high = (uid_t) strtoul(&scratch[CFS_UID_HIGH_LEN+1], NULL, 10);
+ } else if (strncmp(scratch, CFS_UID_NEXT, CFS_UID_NEXT_LEN) == 0) {
+ map->uid_next = (uid_t) strtoul(&scratch[CFS_UID_NEXT_LEN+1], NULL, 10);
+ } else if (strncmp(scratch, CFS_GID_MAP_ENTRY, CFS_GID_MAP_ENTRY_LEN) == 0) {
+ gid_t server_gid;
+ gid_t client_gid;
+ int num = sscanf(&scratch[CFS_GID_MAP_ENTRY_LEN+1],
+ " %u %u", &client_gid, &server_gid);
+ if (num == 2) {
+ if (uidmap_addgidentry(map, server_gid, client_gid) == -1) {
+ return -1;
+ }
+ }
+ } else if (strncmp(scratch, CFS_GID_LOW, CFS_GID_LOW_LEN) == 0) {
+ map->gid_low = (uid_t) strtoul(&scratch[CFS_GID_LOW_LEN+1], NULL, 10);
+ } else if (strncmp(scratch, CFS_GID_HIGH, CFS_GID_HIGH_LEN) == 0) {
+ map->gid_high = (uid_t) strtoul(&scratch[CFS_GID_HIGH_LEN+1], NULL, 10);
+ } else if (strncmp(scratch, CFS_GID_NEXT, CFS_GID_NEXT_LEN) == 0) {
+ map->gid_next = (uid_t) strtoul(&scratch[CFS_GID_NEXT_LEN+1], NULL, 10);
+ }
+ }
+ return 0;
}
static int
uidmap_deserialize_default(char *tenant, uid_t uid_low, uid_t uid_high, gid_t gid_low, gid_t gid_high, short root_squash)
{
- char fname[128], lkname[128];
- FILE* file = NULL;
- int lockfd = -1;
- int ret = 0;
- (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, tenant);
- (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, tenant);
-
- do {
- char scratch[128];
- mapping_t *map;
- char* sts;
- int status;
-
- uidmap_mappings = REALLOC(uidmap_mappings,
- sizeof(mapping_t) * uidmap_num_mappings);
- if (uidmap_mappings == NULL) {
- break;
- }
- map = &uidmap_mappings[uidmap_num_mappings];
- map->name = strdup(tenant);
- map->uid_map = NULL,
- map->uid_map_len = 0,
- map->uid_low = uid_low,
- map->uid_high = uid_high,
- map->uid_next = uid_low,
- map->gid_map = NULL,
- map->gid_map_len = 0,
- map->gid_low = gid_low,
- map->gid_high = gid_high,
- map->gid_next = gid_low,
- map->root_squash = root_squash,
- (void) pthread_mutex_init(&map->mtx, NULL);
- uidmap_num_mappings++;
-
- lockfd = open(lkname, O_CREAT|O_RDONLY, 0644);
- if (lockfd == -1) {
- gf_log(tenant, GF_LOG_CRITICAL,
- "open %s: %s", lkname, strerror(errno));
- break;
- }
- status = flock(lockfd, LOCK_EX);
- if (status == -1) {
- gf_log(tenant, GF_LOG_CRITICAL,
- "flock: %s", strerror(errno));
- break;
- }
- file = fopen(fname, "r");
- if (file == NULL) {
- gf_log(tenant, GF_LOG_INFO,
- "fopen failed: %s", strerror(errno));
- break;
- }
- /* read the first line (signature) of the file) */
- if ((sts = fgets(scratch, sizeof scratch, file)) == (char *) EOF || sts == NULL) {
- gf_log(tenant, GF_LOG_CRITICAL,
- "fgets signature failed: %s", strerror(errno));
- break;
- }
- if (strcmp(CFS_SIGNATURE, scratch) != 0) {
- gf_log(tenant, GF_LOG_CRITICAL,
- "signature mismatch: %s", scratch);
- break;
- }
- ret = uidmap_readmapfile(map, file);
- } while (0);
- if (file != NULL) {
- (void) fclose(file);
- }
- if (lockfd != -1) {
- (void) flock(lockfd, LOCK_UN);
- (void) close(lockfd);
- }
- return ret;
+ char fname[128], lkname[128];
+ FILE* file = NULL;
+ int lockfd = -1;
+ int ret = 0;
+ (void) snprintf(lkname, sizeof lkname, UIDMAP_MAP_LOCK_FILE, tenant);
+ (void) snprintf(fname, sizeof fname, UIDMAP_MAP_FILE, tenant);
+
+ do {
+ char scratch[128];
+ mapping_t *map;
+ char* sts;
+ int status;
+
+ uidmap_mappings = REALLOC(uidmap_mappings,
+ sizeof(mapping_t) * uidmap_num_mappings);
+ if (uidmap_mappings == NULL) {
+ break;
+ }
+ map = &uidmap_mappings[uidmap_num_mappings];
+ map->name = strdup(tenant);
+ map->uid_map = NULL,
+ map->uid_map_len = 0,
+ map->uid_low = uid_low,
+ map->uid_high = uid_high,
+ map->uid_next = uid_low,
+ map->gid_map = NULL,
+ map->gid_map_len = 0,
+ map->gid_low = gid_low,
+ map->gid_high = gid_high,
+ map->gid_next = gid_low,
+ map->root_squash = root_squash,
+ (void) pthread_mutex_init(&map->mtx, NULL);
+ uidmap_num_mappings++;
+
+ lockfd = open(lkname, O_CREAT|O_RDONLY, 0644);
+ if (lockfd == -1) {
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "open %s: %s", lkname, strerror(errno));
+ break;
+ }
+ status = flock(lockfd, LOCK_EX);
+ if (status == -1) {
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "flock: %s", strerror(errno));
+ break;
+ }
+ file = fopen(fname, "r");
+ if (file == NULL) {
+ gf_log(tenant, GF_LOG_INFO,
+ "fopen failed: %s", strerror(errno));
+ break;
+ }
+ /* read the first line (signature) of the file) */
+ sts = fgets(scratch, sizeof scratch, file);
+ if ((sts == (char *) EOF) || (sts == NULL)) {
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "fgets signature failed: %s", strerror(errno));
+ break;
+ }
+ if (strcmp(CFS_SIGNATURE, scratch) != 0) {
+ gf_log(tenant, GF_LOG_CRITICAL,
+ "signature mismatch: %s", scratch);
+ break;
+ }
+ ret = uidmap_readmapfile(map, file);
+ } while (0);
+ if (file != NULL) {
+ (void) fclose(file);
+ }
+ if (lockfd != -1) {
+ (void) flock(lockfd, LOCK_UN);
+ (void) close(lockfd);
+ }
+ return ret;
}
static int
uidmap_map_default(struct _call_stack_t *stack, char *name)
{
- mapping_t *map = uidmap_mappings;
- int do_persist = 0;
- unsigned short i = 0;
- /* assert(uid_num_mappings > 0) */
- for (; i < uidmap_num_mappings; i++, map++) {
- if (strcmp(map->name, name) == 0) {
- break;
- }
- }
- if (stack->uid == 0 && map->root_squash) {
- stack->uid = stack->gid = CLOUDFS_NOBODY;
- return 0;
- }
- pthread_mutex_lock(&map->mtx);
- do {
- unsigned short index = 0;
- if (stack->uid != 0) {
- /* look for an existing match */
- uid_map_entry_t *uid_map_entry = NULL;
- for (; index < map->uid_map_len; index++) {
- if (map->uid_map[index].me_client_uid == stack->uid) {
- uid_map_entry = &map->uid_map[index];
- break;
- }
- }
- if (uid_map_entry == NULL) {
- /* couldn't find one, make a new one */
- if (map->uid_next > map->uid_high) {
- gf_log(name, GF_LOG_CRITICAL,
- "no uids in range %u-%u",
- map->uid_low, map->uid_high);
- pthread_mutex_unlock(&map->mtx);
- return -1;
- }
- uid_map_entry_t *tmpmap =
- REALLOC(map->uid_map, sizeof(uid_map_entry_t) * (map->uid_map_len + 1));
- if (tmpmap == NULL) {
- pthread_mutex_unlock(&map->mtx);
- return -1;
- }
- do_persist = 1;
- map->uid_map = tmpmap;
- uid_map_entry = &map->uid_map[map->uid_map_len++];
- uid_map_entry->me_client_uid = stack->uid;
- uid_map_entry->me_server_uid = map->uid_next++;
- gf_log(name, CFS_LOG_LEVEL,
- "added new uid mapping %u -> %u",
- stack->uid, uid_map_entry->me_server_uid);
- if (map->uid_next > map->uid_high) {
- gf_log(name, GF_LOG_CRITICAL,
- "exhausted uids in range %u-%u",
- map->uid_low, map->uid_high);
- }
- }
- stack->uid = uid_map_entry->me_server_uid;
- }
- if (stack->gid != 0) {
- gid_map_entry_t *gid_map_entry = NULL;
- for (index = 0; index < map->gid_map_len; index++) {
- if (map->gid_map[index].me_client_gid == stack->gid) {
- gid_map_entry = &map->gid_map[index];
- break;
- }
- }
- if (gid_map_entry == NULL) {
- /* couldn't find one, make a new one */
- if (map->gid_next > map->gid_high) {
- gf_log(name, GF_LOG_CRITICAL,
- "no gids in range %u-%u",
- map->gid_low, map->gid_high);
- pthread_mutex_unlock(&map->mtx);
- return -1;
- }
- gid_map_entry_t *tmpmap =
- REALLOC(map->gid_map, sizeof(gid_map_entry_t) * (map->gid_map_len + 1));
- if (tmpmap == NULL) {
- pthread_mutex_unlock(&map->mtx);
- return -1;
- }
- do_persist = 1;
- map->gid_map = tmpmap;
- gid_map_entry = &map->gid_map[map->gid_map_len++];
- gid_map_entry->me_client_gid = stack->gid;
- gid_map_entry->me_server_gid = map->gid_next++;
- gf_log(name, CFS_LOG_LEVEL,
- "added new gid mapping %u -> %u",
- stack->gid, gid_map_entry->me_server_gid);
- if (map->gid_next > map->gid_high) {
- gf_log(name, GF_LOG_CRITICAL,
- "exhausted gids in range %u-%u",
- map->gid_low, map->gid_high);
- }
- }
- stack->gid = gid_map_entry->me_server_gid;
- }
- } while (0);
- if (do_persist > 0)
- uidmap_serialize_default(name, map);
- pthread_mutex_unlock(&map->mtx);
- return 0;
+ mapping_t *map = uidmap_mappings;
+ int do_persist = 0;
+ unsigned short i = 0;
+ /* assert(uid_num_mappings > 0) */
+ for (; i < uidmap_num_mappings; i++, map++) {
+ if (strcmp(map->name, name) == 0) {
+ break;
+ }
+ }
+ if ((stack->uid == 0) && (map->root_squash)) {
+ stack->uid = stack->gid = CLOUDFS_NOBODY;
+ return 0;
+ }
+ pthread_mutex_lock(&map->mtx);
+ do {
+ unsigned short index = 0;
+ if (stack->uid != 0) {
+ /* look for an existing match */
+ uid_map_entry_t *uid_map_entry = NULL;
+ for (; index < map->uid_map_len; index++) {
+ if (map->uid_map[index].me_client_uid == stack->uid) {
+ uid_map_entry = &map->uid_map[index];
+ break;
+ }
+ }
+ if (uid_map_entry == NULL) {
+ /* couldn't find one, make a new one */
+ if (map->uid_next > map->uid_high) {
+ gf_log(name, GF_LOG_CRITICAL,
+ "no uids in range %u-%u",
+ map->uid_low, map->uid_high);
+ pthread_mutex_unlock(&map->mtx);
+ return -1;
+ }
+ uid_map_entry_t *tmpmap =
+ REALLOC(map->uid_map, sizeof(uid_map_entry_t) * (map->uid_map_len + 1));
+ if (tmpmap == NULL) {
+ pthread_mutex_unlock(&map->mtx);
+ return -1;
+ }
+ do_persist = 1;
+ map->uid_map = tmpmap;
+ uid_map_entry = &map->uid_map[map->uid_map_len++];
+ uid_map_entry->me_client_uid = stack->uid;
+ uid_map_entry->me_server_uid = map->uid_next++;
+ gf_log(name, CFS_LOG_LEVEL,
+ "added new uid mapping %u -> %u",
+ stack->uid, uid_map_entry->me_server_uid);
+ if (map->uid_next > map->uid_high) {
+ gf_log(name, GF_LOG_CRITICAL,
+ "exhausted uids in range %u-%u",
+ map->uid_low, map->uid_high);
+ }
+ }
+ stack->uid = uid_map_entry->me_server_uid;
+ }
+ if (stack->gid != 0) {
+ gid_map_entry_t *gid_map_entry = NULL;
+ for (index = 0; index < map->gid_map_len; index++) {
+ if (map->gid_map[index].me_client_gid == stack->gid) {
+ gid_map_entry = &map->gid_map[index];
+ break;
+ }
+ }
+ if (gid_map_entry == NULL) {
+ /* couldn't find one, make a new one */
+ if (map->gid_next > map->gid_high) {
+ gf_log(name, GF_LOG_CRITICAL,
+ "no gids in range %u-%u",
+ map->gid_low, map->gid_high);
+ pthread_mutex_unlock(&map->mtx);
+ return -1;
+ }
+ gid_map_entry_t *tmpmap =
+ REALLOC(map->gid_map, sizeof(gid_map_entry_t) * (map->gid_map_len + 1));
+ if (tmpmap == NULL) {
+ pthread_mutex_unlock(&map->mtx);
+ return -1;
+ }
+ do_persist = 1;
+ map->gid_map = tmpmap;
+ gid_map_entry = &map->gid_map[map->gid_map_len++];
+ gid_map_entry->me_client_gid = stack->gid;
+ gid_map_entry->me_server_gid = map->gid_next++;
+ gf_log(name, CFS_LOG_LEVEL,
+ "added new gid mapping %u -> %u",
+ stack->gid, gid_map_entry->me_server_gid);
+ if (map->gid_next > map->gid_high) {
+ gf_log(name, GF_LOG_CRITICAL,
+ "exhausted gids in range %u-%u",
+ map->gid_low, map->gid_high);
+ }
+ }
+ stack->gid = gid_map_entry->me_server_gid;
+ }
+ } while (0);
+ if (do_persist > 0) {
+ uidmap_serialize_default(name, map);
+ }
+ pthread_mutex_unlock(&map->mtx);
+ return 0;
}
static void
uidmap_revmap_default(uid_t *uid, gid_t *gid, char *name)
{
- uid_map_entry_t *uid_map_entry;
- gid_map_entry_t *gid_map_entry;
- mapping_t *map = uidmap_mappings;
- unsigned int index = 0;
- unsigned short i = 0;
-
- /* assert(uid_num_mappings > 0) */
- for (; i < uidmap_num_mappings; i++, map++) {
- if (strcmp(map->name, name) == 0) {
- break;
- }
- }
-
- switch (*uid) {
- case 0:
- /* break; */
- case CLOUDFS_NOBODY:
- *uid = 0;
- break;
- default:
- uid_map_entry = map->uid_map;
- for (; index < map->uid_map_len; index++, uid_map_entry++) {
- if (*uid == uid_map_entry->me_server_uid)
- *uid = uid_map_entry->me_client_uid;
- }
- break;
- }
- switch (*gid) {
- case 0:
- /* break; */
- case CLOUDFS_NOBODY:
- *uid = 0;
- break;
- default:
- gid_map_entry = map->gid_map;
- for (index = 0; index < map->gid_map_len; index++, gid_map_entry++) {
- if (*gid == gid_map_entry->me_server_gid)
- *gid = gid_map_entry->me_client_gid;
- }
- break;
- }
+ uid_map_entry_t *uid_map_entry;
+ gid_map_entry_t *gid_map_entry;
+ mapping_t *map = uidmap_mappings;
+ unsigned int index = 0;
+ unsigned short i = 0;
+
+ /* assert(uid_num_mappings > 0) */
+ for (; i < uidmap_num_mappings; i++, map++) {
+ if (strcmp(map->name, name) == 0) {
+ break;
+ }
+ }
+
+ switch (*uid) {
+ case 0:
+ /* break; */
+ case CLOUDFS_NOBODY:
+ *uid = 0;
+ break;
+ default:
+ uid_map_entry = map->uid_map;
+ for (; index < map->uid_map_len; index++, uid_map_entry++) {
+ if (*uid == uid_map_entry->me_server_uid) {
+ *uid = uid_map_entry->me_client_uid;
+ }
+ }
+ break;
+ }
+ switch (*gid) {
+ case 0:
+ /* break; */
+ case CLOUDFS_NOBODY:
+ *uid = 0;
+ break;
+ default:
+ gid_map_entry = map->gid_map;
+ for (index = 0; index < map->gid_map_len; index++, gid_map_entry++) {
+ if (*gid == gid_map_entry->me_server_gid) {
+ *gid = gid_map_entry->me_client_gid;
+ }
+ }
+ break;
+ }
}
@@ -485,1358 +494,1395 @@ static fini_fn uidmap_plugin_fini = NULL;
int
uidmap_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd,
- inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno, fd_t *fd,
+ inode_t *inode, struct iatt *buf,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(create, frame, op_ret, op_errno, fd, inode, buf,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(create, frame, op_ret, op_errno, fd, inode, buf,
+ preparent, postparent);
+ return 0;
}
int
uidmap_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd)
+ int32_t op_ret, int32_t op_errno, fd_t *fd)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d, *fd=%p)",
- frame->root->unique, op_ret, op_errno, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d, *fd=%p)",
+ frame->root->unique, op_ret, op_errno, fd);
- STACK_UNWIND_STRICT(open, frame, op_ret, op_errno, fd);
- return 0;
+ STACK_UNWIND_STRICT(open, frame, op_ret, op_errno, fd);
+ return 0;
}
int
uidmap_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *buf)
+ int32_t op_ret, int32_t op_errno, struct iatt *buf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(stat, frame, op_ret, op_errno, buf);
- return 0;
+ STACK_UNWIND_STRICT(stat, frame, op_ret, op_errno, buf);
+ return 0;
}
int
uidmap_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iovec *vector,
- int32_t count, struct iatt *buf, struct iobref *iobref)
+ int32_t op_ret, int32_t op_errno, struct iovec *vector,
+ int32_t count, struct iatt *buf, struct iobref *iobref)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(readv, frame, op_ret, op_errno, vector, count,
- buf, iobref);
- return 0;
+ STACK_UNWIND_STRICT(readv, frame, op_ret, op_errno, vector, count,
+ buf, iobref);
+ return 0;
}
int
uidmap_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
- (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+ (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(writev, frame, op_ret, op_errno, prebuf, postbuf);
- return 0;
+ STACK_UNWIND_STRICT(writev, frame, op_ret, op_errno, prebuf, postbuf);
+ return 0;
}
int
uidmap_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, gf_dirent_t *buf)
+ int32_t op_ret, int32_t op_errno, gf_dirent_t *buf)
{
- struct _gf_dirent_t *entry;
+ struct _gf_dirent_t *entry;
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64" :(op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64" :(op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid, this->name);
- list_for_each_entry(entry, &buf->list, list) {
- (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid, this->name);
- }
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid, this->name);
+ list_for_each_entry(entry, &buf->list, list) {
+ (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid, this->name);
+ }
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(readdir, frame, op_ret, op_errno, buf);
+ STACK_UNWIND_STRICT(readdir, frame, op_ret, op_errno, buf);
- return 0;
+ return 0;
}
int
uidmap_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, gf_dirent_t *buf)
+ int32_t op_ret, int32_t op_errno, gf_dirent_t *buf)
{
- struct _gf_dirent_t *entry = NULL;
+ struct _gf_dirent_t *entry = NULL;
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64" :(op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64" :(op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid, this->name);
- list_for_each_entry(entry, &buf->list, list) {
- (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid, this->name);
- }
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->d_stat.ia_uid, &buf->d_stat.ia_gid, this->name);
+ list_for_each_entry(entry, &buf->list, list) {
+ (*uidmap_revmap)(&entry->d_stat.ia_uid, &entry->d_stat.ia_gid, this->name);
+ }
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(readdirp, frame, op_ret, op_errno, buf);
+ STACK_UNWIND_STRICT(readdirp, frame, op_ret, op_errno, buf);
- return 0;
+ return 0;
}
int
uidmap_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
- (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+ (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(fsync, frame, op_ret, op_errno, prebuf, postbuf);
+ STACK_UNWIND_STRICT(fsync, frame, op_ret, op_errno, prebuf, postbuf);
- return 0;
+ return 0;
}
int
uidmap_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *statpre, struct iatt *statpost)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid, this->name);
- (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid, this->name);
+ (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(setattr, frame, op_ret, op_errno, statpre, statpost);
- return 0;
+ STACK_UNWIND_STRICT(setattr, frame, op_ret, op_errno, statpre, statpost);
+ return 0;
}
int
uidmap_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *statpre, struct iatt *statpost)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *statpre, struct iatt *statpost)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid, this->name);
- (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&statpre->ia_uid, &statpre->ia_gid, this->name);
+ (*uidmap_revmap)(&statpost->ia_uid, &statpost->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(fsetattr, frame, op_ret, op_errno,
- statpre, statpost);
- return 0;
+ STACK_UNWIND_STRICT(fsetattr, frame, op_ret, op_errno,
+ statpre, statpost);
+ return 0;
}
int
uidmap_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(unlink, frame, op_ret, op_errno,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(unlink, frame, op_ret, op_errno,
+ preparent, postparent);
+ return 0;
}
int
uidmap_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *buf,
- struct iatt *preoldparent, struct iatt *postoldparent,
- struct iatt *prenewparent, struct iatt *postnewparent)
+ int32_t op_ret, int32_t op_errno, struct iatt *buf,
+ struct iatt *preoldparent, struct iatt *postoldparent,
+ struct iatt *prenewparent, struct iatt *postnewparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&preoldparent->ia_uid, &preoldparent->ia_gid, this->name);
- (*uidmap_revmap)(&postoldparent->ia_uid, &postoldparent->ia_gid, this->name);
- (*uidmap_revmap)(&prenewparent->ia_uid, &prenewparent->ia_gid, this->name);
- (*uidmap_revmap)(&postnewparent->ia_uid, &postnewparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&preoldparent->ia_uid, &preoldparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postoldparent->ia_uid, &postoldparent->ia_gid, this->name);
+ (*uidmap_revmap)(&prenewparent->ia_uid, &prenewparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postnewparent->ia_uid, &postnewparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(rename, frame, op_ret, op_errno, buf,
- preoldparent, postoldparent,
- prenewparent, postnewparent);
- return 0;
+ STACK_UNWIND_STRICT(rename, frame, op_ret, op_errno, buf,
+ preoldparent, postoldparent,
+ prenewparent, postnewparent);
+ return 0;
}
int
uidmap_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- const char *buf, struct iatt *stbuf)
+ int32_t op_ret, int32_t op_errno,
+ const char *buf, struct iatt *stbuf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&stbuf->ia_uid, &stbuf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&stbuf->ia_uid, &stbuf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(readlink, frame, op_ret, op_errno, buf, stbuf);
- return 0;
+ STACK_UNWIND_STRICT(readlink, frame, op_ret, op_errno, buf, stbuf);
+ return 0;
}
int
uidmap_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *buf,
- dict_t *xattr, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf,
+ dict_t *xattr, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(lookup, frame, op_ret, op_errno, inode, buf,
- xattr, postparent);
- return 0;
+ STACK_UNWIND_STRICT(lookup, frame, op_ret, op_errno, inode, buf,
+ xattr, postparent);
+ return 0;
}
int
uidmap_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(symlink, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(symlink, frame, op_ret, op_errno, inode, buf,
+ preparent, postparent);
+ return 0;
}
int
uidmap_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(mknod, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(mknod, frame, op_ret, op_errno, inode, buf,
+ preparent, postparent);
+ return 0;
}
int
uidmap_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(mkdir, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(mkdir, frame, op_ret, op_errno, inode, buf,
+ preparent, postparent);
+ return 0;
}
int
uidmap_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ inode_t *inode, struct iatt *buf,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(link, frame, op_ret, op_errno, inode, buf,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(link, frame, op_ret, op_errno, inode, buf,
+ preparent, postparent);
+ return 0;
}
int
uidmap_flush_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(flush, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(flush, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd)
+ int32_t op_ret, int32_t op_errno, fd_t *fd)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d, fd=%p)",
- frame->root->unique, op_ret, op_errno, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d, fd=%p)",
+ frame->root->unique, op_ret, op_errno, fd);
- STACK_UNWIND_STRICT(opendir, frame, op_ret, op_errno, fd);
- return 0;
+ STACK_UNWIND_STRICT(opendir, frame, op_ret, op_errno, fd);
+ return 0;
}
int
uidmap_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *preparent, struct iatt *postparent)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *preparent, struct iatt *postparent)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
- (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&preparent->ia_uid, &preparent->ia_gid, this->name);
+ (*uidmap_revmap)(&postparent->ia_uid, &postparent->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(rmdir, frame, op_ret, op_errno,
- preparent, postparent);
- return 0;
+ STACK_UNWIND_STRICT(rmdir, frame, op_ret, op_errno,
+ preparent, postparent);
+ return 0;
}
int
uidmap_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
- (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+ (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(truncate, frame, op_ret, op_errno, prebuf, postbuf);
- return 0;
+ STACK_UNWIND_STRICT(truncate, frame, op_ret, op_errno, prebuf, postbuf);
+ return 0;
}
int
uidmap_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct statvfs *buf)
+ int32_t op_ret, int32_t op_errno, struct statvfs *buf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(statfs, frame, op_ret, op_errno, buf);
- return 0;
+ STACK_UNWIND_STRICT(statfs, frame, op_ret, op_errno, buf);
+ return 0;
}
int
uidmap_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(setxattr, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(setxattr, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict)
+ int32_t op_ret, int32_t op_errno, dict_t *dict)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d, dict=%p)",
- frame->root->unique, op_ret, op_errno, dict);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d, dict=%p)",
+ frame->root->unique, op_ret, op_errno, dict);
- STACK_UNWIND_STRICT(getxattr, frame, op_ret, op_errno, dict);
+ STACK_UNWIND_STRICT(getxattr, frame, op_ret, op_errno, dict);
- return 0;
+ return 0;
}
int
uidmap_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(removexattr, frame, op_ret, op_errno);
+ STACK_UNWIND_STRICT(removexattr, frame, op_ret, op_errno);
- return 0;
+ return 0;
}
int
uidmap_fsyncdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(fsyncdir, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(fsyncdir, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_access_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(access, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(access, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf)
+ int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
- (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&prebuf->ia_uid, &prebuf->ia_gid, this->name);
+ (*uidmap_revmap)(&postbuf->ia_uid, &postbuf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(ftruncate, frame, op_ret, op_errno, prebuf, postbuf);
- return 0;
+ STACK_UNWIND_STRICT(ftruncate, frame, op_ret, op_errno, prebuf, postbuf);
+ return 0;
}
int
uidmap_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *buf)
+ int32_t op_ret, int32_t op_errno, struct iatt *buf)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&buf->ia_uid, &buf->ia_gid, this->name);
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(fstat, frame, op_ret, op_errno, buf);
- return 0;
+ STACK_UNWIND_STRICT(fstat, frame, op_ret, op_errno, buf);
+ return 0;
}
int
uidmap_lk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct gf_flock *lock)
+ int32_t op_ret, int32_t op_errno, struct gf_flock *lock)
{
- uid_t uid;
- gid_t gid;
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ uid_t uid;
+ gid_t gid;
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- (*uidmap_revmap)(&uid, &gid, this->name);
- lock->l_owner = uid;
- (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
+ (*uidmap_revmap)(&uid, &gid, this->name);
+ lock->l_owner = uid;
+ (*uidmap_revmap)(&frame->root->uid, &frame->root->gid, this->name);
- STACK_UNWIND_STRICT(lk, frame, op_ret, op_errno, lock);
- return 0;
+ STACK_UNWIND_STRICT(lk, frame, op_ret, op_errno, lock);
+ return 0;
}
int
uidmap_entrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": op_ret=%d, op_errno=%d",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": op_ret=%d, op_errno=%d",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(entrylk, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(entrylk, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_fentrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": op_ret=%d, op_errno=%d",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": op_ret=%d, op_errno=%d",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(entrylk, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(entrylk, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_xattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict)
+ int32_t op_ret, int32_t op_errno, dict_t *dict)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(xattrop, frame, op_ret, op_errno, dict);
- return 0;
+ STACK_UNWIND_STRICT(xattrop, frame, op_ret, op_errno, dict);
+ return 0;
}
int
uidmap_fxattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, dict_t *dict)
+ int32_t op_ret, int32_t op_errno, dict_t *dict)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (op_ret=%d, op_errno=%d)",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (op_ret=%d, op_errno=%d)",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(fxattrop, frame, op_ret, op_errno, dict);
- return 0;
+ STACK_UNWIND_STRICT(fxattrop, frame, op_ret, op_errno, dict);
+ return 0;
}
int
uidmap_inodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": op_ret=%d, op_errno=%d",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": op_ret=%d, op_errno=%d",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(inodelk, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(inodelk, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_finodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
+ int32_t op_ret, int32_t op_errno)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": op_ret=%d, op_errno=%d",
- frame->root->unique, op_ret, op_errno);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": op_ret=%d, op_errno=%d",
+ frame->root->unique, op_ret, op_errno);
- STACK_UNWIND_STRICT(finodelk, frame, op_ret, op_errno);
- return 0;
+ STACK_UNWIND_STRICT(finodelk, frame, op_ret, op_errno);
+ return 0;
}
int
uidmap_entrylk(call_frame_t *frame, xlator_t *this,
- const char *volume, loc_t *loc, const char *basename,
- entrylk_cmd cmd, entrylk_type type)
+ const char *volume, loc_t *loc, const char *basename,
+ entrylk_cmd cmd, entrylk_type type)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": volume=%s, (loc= {path=%s, ino=%"PRIu64"} basename=%s, cmd=%s, type=%s)",
- frame->root->unique, volume, loc->path, loc->inode->ino, basename,
- ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
- ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": volume=%s, (loc= {path=%s, ino=%"PRIu64"} basename=%s, cmd=%s, type=%s)",
+ frame->root->unique, volume, loc->path, loc->inode->ino, basename,
+ ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
+ ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_entrylk_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->entrylk,
- volume, loc, basename, cmd, type);
- return 0;
+ STACK_WIND(frame, uidmap_entrylk_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->entrylk,
+ volume, loc, basename, cmd, type);
+ return 0;
}
int
uidmap_fentrylk(call_frame_t *frame, xlator_t *this,
- const char *volume, fd_t *fd, const char *basename,
- entrylk_cmd cmd, entrylk_type type)
+ const char *volume, fd_t *fd, const char *basename,
+ entrylk_cmd cmd, entrylk_type type)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": volume=%s, fd=%p, basename=%s, cmd=%s, type=%s)",
- frame->root->unique, volume, fd, basename,
- ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
- ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": volume=%s, fd=%p, basename=%s, cmd=%s, type=%s)",
+ frame->root->unique, volume, fd, basename,
+ ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"),
+ ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK"));
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_fentrylk_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fentrylk,
- volume, fd, basename, cmd, type);
- return 0;
+ STACK_WIND(frame, uidmap_fentrylk_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fentrylk,
+ volume, fd, basename, cmd, type);
+ return 0;
}
int
uidmap_inodelk(call_frame_t *frame, xlator_t *this, const char *volume,
- loc_t *loc, int32_t cmd, struct gf_flock *flock)
+ loc_t *loc, int32_t cmd, struct gf_flock *flock)
{
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_inodelk_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->inodelk,
- volume, loc, cmd, flock);
- return 0;
+ STACK_WIND(frame, uidmap_inodelk_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->inodelk,
+ volume, loc, cmd, flock);
+ return 0;
}
int
uidmap_finodelk(call_frame_t *frame, xlator_t *this, const char *volume,
- fd_t *fd, int32_t cmd, struct gf_flock *flock)
+ fd_t *fd, int32_t cmd, struct gf_flock *flock)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (volume=%s, fd=%p, cmd=%d)",
- frame->root->unique, volume, fd, cmd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (volume=%s, fd=%p, cmd=%d)",
+ frame->root->unique, volume, fd, cmd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_finodelk_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->finodelk,
- volume, fd, cmd, flock);
- return 0;
+ STACK_WIND(frame, uidmap_finodelk_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->finodelk,
+ volume, fd, cmd, flock);
+ return 0;
}
int
uidmap_xattrop(call_frame_t *frame, xlator_t *this, loc_t *loc,
- gf_xattrop_flags_t flags, dict_t *dict)
+ gf_xattrop_flags_t flags, dict_t *dict)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (path=%s, ino=%"PRIu64" flags=%d)",
- frame->root->unique, loc->path, loc->inode->ino, flags);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (path=%s, ino=%"PRIu64" flags=%d)",
+ frame->root->unique, loc->path, loc->inode->ino, flags);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_xattrop_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->xattrop,
- loc, flags, dict);
+ STACK_WIND(frame, uidmap_xattrop_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->xattrop,
+ loc, flags, dict);
- return 0;
+ return 0;
}
int
uidmap_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
- gf_xattrop_flags_t flags, dict_t *dict)
+ gf_xattrop_flags_t flags, dict_t *dict)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (fd=%p, flags=%d)",
- frame->root->unique, fd, flags);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (fd=%p, flags=%d)",
+ frame->root->unique, fd, flags);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_fxattrop_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fxattrop,
- fd, flags, dict);
+ STACK_WIND(frame, uidmap_fxattrop_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fxattrop,
+ fd, flags, dict);
- return 0;
+ return 0;
}
int
uidmap_lookup(call_frame_t *frame, xlator_t *this,
- loc_t *loc, dict_t *xattr_req)
+ loc_t *loc, dict_t *xattr_req)
{
- /* TODO: print all the keys mentioned in xattr_req */
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, loc->path,
- loc->inode->ino);
+ /* TODO: print all the keys mentioned in xattr_req */
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
+ frame->root->unique, loc->path,
+ loc->inode->ino);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_lookup_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->lookup,
- loc, xattr_req);
+ STACK_WIND(frame, uidmap_lookup_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->lookup,
+ loc, xattr_req);
- return 0;
+ return 0;
}
int
uidmap_stat(call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, loc->path, loc->inode->ino);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
+ frame->root->unique, loc->path, loc->inode->ino);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_stat_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->stat,
- loc);
+ STACK_WIND(frame, uidmap_stat_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->stat,
+ loc);
- return 0;
+ return 0;
}
int
uidmap_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, size=%"GF_PRI_SIZET")",
- frame->root->unique, loc->path, loc->inode->ino, size);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, size=%"GF_PRI_SIZET")",
+ frame->root->unique, loc->path, loc->inode->ino, size);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_readlink_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->readlink,
- loc, size);
+ STACK_WIND(frame, uidmap_readlink_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->readlink,
+ loc, size);
- return 0;
+ return 0;
}
int
uidmap_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode, dev_t dev, dict_t *params)
+ mode_t mode, dev_t dev, dict_t *params)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, mode=%d, dev=%"GF_PRI_DEV")",
- frame->root->unique, loc->path, loc->inode->ino, mode, dev);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, mode=%d, dev=%"GF_PRI_DEV")",
+ frame->root->unique, loc->path, loc->inode->ino, mode, dev);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_mknod_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->mknod,
- loc, mode, dev, params);
+ STACK_WIND(frame, uidmap_mknod_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->mknod,
+ loc, mode, dev, params);
- return 0;
+ return 0;
}
int
uidmap_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
- dict_t *params)
+ dict_t *params)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (path=%s, ino=%"PRIu64", mode=%d)",
- frame->root->unique, loc->path,
- ((loc->inode)? loc->inode->ino : 0), mode);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (path=%s, ino=%"PRIu64", mode=%d)",
+ frame->root->unique, loc->path,
+ ((loc->inode)? loc->inode->ino : 0), mode);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_mkdir_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->mkdir,
- loc, mode, params);
- return 0;
+ STACK_WIND(frame, uidmap_mkdir_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->mkdir,
+ loc, mode, params);
+ return 0;
}
int
uidmap_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, loc->path, loc->inode->ino);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
+ frame->root->unique, loc->path, loc->inode->ino);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_unlink_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->unlink,
- loc);
- return 0;
+ STACK_WIND(frame, uidmap_unlink_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->unlink,
+ loc);
+ return 0;
}
int
uidmap_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=%d)",
- frame->root->unique, loc->path, loc->inode->ino, flags);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=%d)",
+ frame->root->unique, loc->path, loc->inode->ino, flags);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_rmdir_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->rmdir,
- loc, flags);
+ STACK_WIND(frame, uidmap_rmdir_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->rmdir,
+ loc, flags);
- return 0;
+ return 0;
}
int
uidmap_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
- loc_t *loc, dict_t *params)
+ loc_t *loc, dict_t *params)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (linkpath=%s, loc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, linkpath, loc->path,
- ((loc->inode)? loc->inode->ino : 0));
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (linkpath=%s, loc {path=%s, ino=%"PRIu64"})",
+ frame->root->unique, linkpath, loc->path,
+ ((loc->inode)? loc->inode->ino : 0));
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_symlink_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->symlink,
- linkpath, loc, params);
+ STACK_WIND(frame, uidmap_symlink_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->symlink,
+ linkpath, loc, params);
- return 0;
+ return 0;
}
int
uidmap_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (oldloc {path=%s, ino=%"PRIu64"}, "
- "newloc{path=%s, ino=%"PRIu64"})",
- frame->root->unique, oldloc->path, oldloc->ino,
- newloc->path, newloc->ino);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (oldloc {path=%s, ino=%"PRIu64"}, "
+ "newloc{path=%s, ino=%"PRIu64"})",
+ frame->root->unique, oldloc->path, oldloc->ino,
+ newloc->path, newloc->ino);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_rename_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->rename,
- oldloc, newloc);
+ STACK_WIND(frame, uidmap_rename_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->rename,
+ oldloc, newloc);
- return 0;
+ return 0;
}
int
uidmap_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (oldloc {path=%s, ino=%"PRIu64"}, "
- "newloc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, oldloc->path, oldloc->inode->ino,
- newloc->path, newloc->inode->ino);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (oldloc {path=%s, ino=%"PRIu64"}, "
+ "newloc {path=%s, ino=%"PRIu64"})",
+ frame->root->unique, oldloc->path, oldloc->inode->ino,
+ newloc->path, newloc->inode->ino);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_link_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->link,
- oldloc, newloc);
- return 0;
+ STACK_WIND(frame, uidmap_link_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->link,
+ oldloc, newloc);
+ return 0;
}
int
uidmap_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct iatt *stbuf, int32_t valid)
+ struct iatt *stbuf, int32_t valid)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": loc {path=%s, ino=%"PRIu64"}, valid=%d",
- frame->root->unique, loc->path, loc->inode->ino, valid);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": loc {path=%s, ino=%"PRIu64"}, valid=%d",
+ frame->root->unique, loc->path, loc->inode->ino, valid);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_setattr_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->setattr,
- loc, stbuf, valid);
+ STACK_WIND(frame, uidmap_setattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->setattr,
+ loc, stbuf, valid);
- return 0;
+ return 0;
}
int
uidmap_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iatt *stbuf, int32_t valid)
+ struct iatt *stbuf, int32_t valid)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (fd=%p, valid=%d)",
- frame->root->unique, fd, valid);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (fd=%p, valid=%d)",
+ frame->root->unique, fd, valid);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_fsetattr_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fsetattr,
- fd, stbuf, valid);
+ STACK_WIND(frame, uidmap_fsetattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fsetattr,
+ fd, stbuf, valid);
- return 0;
+ return 0;
}
int
uidmap_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc,
- off_t offset)
+ off_t offset)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, offset=%"PRId64")",
- frame->root->unique, loc->path, loc->inode->ino, offset);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, offset=%"PRId64")",
+ frame->root->unique, loc->path, loc->inode->ino, offset);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_truncate_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->truncate,
- loc, offset);
+ STACK_WIND(frame, uidmap_truncate_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->truncate,
+ loc, offset);
- return 0;
+ return 0;
}
int
uidmap_open(call_frame_t *frame, xlator_t *this, loc_t *loc,
- int32_t flags, fd_t *fd, int32_t wbflags)
+ int32_t flags, fd_t *fd, int32_t wbflags)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=%d, "
- "fd=%p, wbflags=%d)",
- frame->root->unique, loc->path, loc->inode->ino, flags,
- fd, wbflags);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=%d, "
+ "fd=%p, wbflags=%d)",
+ frame->root->unique, loc->path, loc->inode->ino, flags,
+ fd, wbflags);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_open_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->open,
- loc, flags, fd, wbflags);
- return 0;
+ STACK_WIND(frame, uidmap_open_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->open,
+ loc, flags, fd, wbflags);
+ return 0;
}
int
uidmap_create(call_frame_t *frame, xlator_t *this, loc_t *loc,
- int32_t flags, mode_t mode, fd_t *fd, dict_t *params)
+ int32_t flags, mode_t mode, fd_t *fd, dict_t *params)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=0%o mode=0%o)",
- frame->root->unique, loc->path, loc->inode->ino, flags, mode);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=0%o mode=0%o)",
+ frame->root->unique, loc->path, loc->inode->ino, flags, mode);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_create_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->create,
- loc, flags, mode, fd, params);
- return 0;
+ STACK_WIND(frame, uidmap_create_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->create,
+ loc, flags, mode, fd, params);
+ return 0;
}
int
uidmap_readv(call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset)
+ size_t size, off_t offset)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (*fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
- frame->root->unique, fd, size, offset);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (*fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
+ frame->root->unique, fd, size, offset);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_readv_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->readv,
- fd, size, offset);
- return 0;
+ STACK_WIND(frame, uidmap_readv_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->readv,
+ fd, size, offset);
+ return 0;
}
int
uidmap_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iovec *vector, int32_t count,
- off_t offset, struct iobref *iobref)
+ struct iovec *vector, int32_t count,
+ off_t offset, struct iobref *iobref)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (*fd=%p, *vector=%p, count=%d, offset=%"PRId64")",
- frame->root->unique, fd, vector, count, offset);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (*fd=%p, *vector=%p, count=%d, offset=%"PRId64")",
+ frame->root->unique, fd, vector, count, offset);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_writev_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->writev,
- fd, vector, count, offset, iobref);
- return 0;
+ STACK_WIND(frame, uidmap_writev_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->writev,
+ fd, vector, count, offset, iobref);
+ return 0;
}
int
uidmap_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, loc->path,
- ((loc->inode)? loc->inode->ino : 0));
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
+ frame->root->unique, loc->path,
+ ((loc->inode)? loc->inode->ino : 0));
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_statfs_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->statfs,
- loc);
- return 0;
+ STACK_WIND(frame, uidmap_statfs_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->statfs,
+ loc);
+ return 0;
}
int
uidmap_flush(call_frame_t *frame, xlator_t *this, fd_t *fd)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (*fd=%p)", frame->root->unique, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (*fd=%p)", frame->root->unique, fd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_flush_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->flush,
- fd);
- return 0;
+ STACK_WIND(frame, uidmap_flush_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->flush,
+ fd);
+ return 0;
}
int
uidmap_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (flags=%d, *fd=%p)", frame->root->unique, flags, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (flags=%d, *fd=%p)", frame->root->unique, flags, fd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_fsync_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fsync,
- fd, flags);
- return 0;
+ STACK_WIND(frame, uidmap_fsync_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fsync,
+ fd, flags);
+ return 0;
}
int
uidmap_setxattr(call_frame_t *frame, xlator_t *this,
- loc_t *loc, dict_t *dict, int32_t flags)
+ loc_t *loc, dict_t *dict, int32_t flags)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, dict=%p, flags=%d)",
- frame->root->unique, loc->path,
- ((loc->inode)? loc->inode->ino : 0), dict, flags);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, dict=%p, flags=%d)",
+ frame->root->unique, loc->path,
+ ((loc->inode)? loc->inode->ino : 0), dict, flags);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_setxattr_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->setxattr,
- loc, dict, flags);
- return 0;
+ STACK_WIND(frame, uidmap_setxattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->setxattr,
+ loc, dict, flags);
+ return 0;
}
int
uidmap_getxattr(call_frame_t *frame, xlator_t *this,
- loc_t *loc, const char *name)
+ loc_t *loc, const char *name)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}), name=%s",
- frame->root->unique, loc->path,
- ((loc->inode)? loc->inode->ino : 0), name);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}), name=%s",
+ frame->root->unique, loc->path,
+ ((loc->inode)? loc->inode->ino : 0), name);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_getxattr_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->getxattr,
- loc, name);
- return 0;
+ STACK_WIND(frame, uidmap_getxattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->getxattr,
+ loc, name);
+ return 0;
}
int
uidmap_removexattr(call_frame_t *frame, xlator_t *this,
- loc_t *loc, const char *name)
+ loc_t *loc, const char *name)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, name=%s)",
- frame->root->unique, loc->path,
- ((loc->inode)? loc->inode->ino : 0), name);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, name=%s)",
+ frame->root->unique, loc->path,
+ ((loc->inode)? loc->inode->ino : 0), name);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_removexattr_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->removexattr,
- loc, name);
+ STACK_WIND(frame, uidmap_removexattr_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->removexattr,
+ loc, name);
- return 0;
+ return 0;
}
int
uidmap_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64":( loc {path=%s, ino=%"PRIu64"}, fd=%p)",
- frame->root->unique, loc->path, loc->inode->ino, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64":( loc {path=%s, ino=%"PRIu64"}, fd=%p)",
+ frame->root->unique, loc->path, loc->inode->ino, fd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_opendir_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->opendir,
- loc, fd);
- return 0;
+ STACK_WIND(frame, uidmap_opendir_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->opendir,
+ loc, fd);
+ return 0;
}
int
uidmap_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
- frame->root->unique, fd, size, offset);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
+ frame->root->unique, fd, size, offset);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_readdirp_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->readdirp,
- fd, size, offset);
+ STACK_WIND(frame, uidmap_readdirp_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->readdirp,
+ fd, size, offset);
- return 0;
+ return 0;
}
int
uidmap_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd,
- size_t size, off_t offset)
+ size_t size, off_t offset)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
- frame->root->unique, fd, size, offset);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64")",
+ frame->root->unique, fd, size, offset);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_readdir_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->readdir,
- fd, size, offset);
+ STACK_WIND(frame, uidmap_readdir_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->readdir,
+ fd, size, offset);
- return 0;
+ return 0;
}
int
uidmap_fsyncdir(call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t datasync)
+ fd_t *fd, int32_t datasync)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (datasync=%d, *fd=%p)",
- frame->root->unique, datasync, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (datasync=%d, *fd=%p)",
+ frame->root->unique, datasync, fd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_fsyncdir_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fsyncdir,
- fd, datasync);
- return 0;
+ STACK_WIND(frame, uidmap_fsyncdir_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fsyncdir,
+ fd, datasync);
+ return 0;
}
int
uidmap_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (*loc {path=%s, ino=%"PRIu64"}, mask=0%o)",
- frame->root->unique, loc->path,
- ((loc->inode)? loc->inode->ino : 0), mask);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (*loc {path=%s, ino=%"PRIu64"}, mask=0%o)",
+ frame->root->unique, loc->path,
+ ((loc->inode)? loc->inode->ino : 0), mask);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_access_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->access,
- loc, mask);
- return 0;
+ STACK_WIND(frame, uidmap_access_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->access,
+ loc, mask);
+ return 0;
}
int
uidmap_ftruncate(call_frame_t *frame, xlator_t *this,
- fd_t *fd, off_t offset)
+ fd_t *fd, off_t offset)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (offset=%"PRId64", *fd=%p)",
- frame->root->unique, offset, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (offset=%"PRId64", *fd=%p)",
+ frame->root->unique, offset, fd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_ftruncate_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->ftruncate,
- fd, offset);
+ STACK_WIND(frame, uidmap_ftruncate_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->ftruncate,
+ fd, offset);
- return 0;
+ return 0;
}
int
uidmap_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (*fd=%p)", frame->root->unique, fd);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (*fd=%p)", frame->root->unique, fd);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_fstat_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->fstat,
- fd);
- return 0;
+ STACK_WIND(frame, uidmap_fstat_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->fstat,
+ fd);
+ return 0;
}
int
uidmap_lk(call_frame_t *frame, xlator_t *this, fd_t *fd,
- int32_t cmd, struct gf_flock *lock)
+ int32_t cmd, struct gf_flock *lock)
{
- gf_log(this->name, CFS_LOG_LEVEL,
- "%"PRId64": (*fd=%p, cmd=%d, lock {l_type=%d, l_whence=%d, "
- "l_start=%"PRId64", l_len=%"PRId64", l_pid=%u})",
- frame->root->unique, fd, cmd, lock->l_type, lock->l_whence,
- lock->l_start, lock->l_len, lock->l_pid);
+ gf_log(this->name, CFS_LOG_LEVEL,
+ "%"PRId64": (*fd=%p, cmd=%d, lock {l_type=%d, l_whence=%d, "
+ "l_start=%"PRId64", l_len=%"PRId64", l_pid=%u})",
+ frame->root->unique, fd, cmd, lock->l_type, lock->l_whence,
+ lock->l_start, lock->l_len, lock->l_pid);
- if ((*uidmap_map)(frame->root, this->name) == -1)
- return -1;
+ if ((*uidmap_map)(frame->root, this->name) == -1) {
+ return -1;
+ }
- STACK_WIND(frame, uidmap_lk_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->lk,
- fd, cmd, lock);
- return 0;
+ STACK_WIND(frame, uidmap_lk_cbk,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->lk,
+ fd, cmd, lock);
+ return 0;
}
static init_fn
uidmap_loadsharedlib(char* xltrname, char *libname)
{
- init_fn plugin_init = NULL;
- void *handle = NULL;
+ init_fn plugin_init = NULL;
+ void *handle = NULL;
char *plugin_path = NULL;
int ret = -1;
@@ -1848,224 +1894,239 @@ uidmap_loadsharedlib(char* xltrname, char *libname)
libname);
if (ret < 0) {
gf_log(xltrname,GF_LOG_ERROR,
- "could not construct plugin path for %s",
- libname);
+ "could not construct plugin path for %s",
+ libname);
return NULL;
}
}
gf_log(xltrname, CFS_LOG_LEVEL, "loading %s (%s)", plugin_path,
- (plugin_path == libname) ? "given" : "constructed");
+ (plugin_path == libname) ? "given" : "constructed");
- handle = dlopen(plugin_path, RTLD_NOW|RTLD_NODELETE);
+ handle = dlopen(plugin_path, RTLD_NOW|RTLD_NODELETE);
if (!handle) {
gf_log(xltrname, GF_LOG_ERROR, "dlopen failed (%s)", dlerror());
return NULL;
}
- if ((uidmap_map = (map_fn) dlsym(handle, "map")) == NULL) {
+ uidmap_map = (map_fn) dlsym(handle, "map");
+ if (uidmap_map == NULL) {
gf_log(xltrname, GF_LOG_CRITICAL,
- "plugin missing map: %s", dlerror());
+ "plugin missing map: %s", dlerror());
goto close_it;
}
- if ((uidmap_revmap = (revmap_fn) dlsym(handle, "revmap")) == NULL) {
+ uidmap_revmap = (revmap_fn) dlsym(handle, "revmap");
+ if (uidmap_revmap == NULL) {
gf_log(xltrname, GF_LOG_CRITICAL,
- "plugin missing revmap: %s", dlerror());
+ "plugin missing revmap: %s", dlerror());
goto close_it;
}
- if ((uidmap_plugin_fini = (fini_fn) dlsym(handle, "fini")) == NULL) {
+ uidmap_plugin_fini = (fini_fn) dlsym(handle, "fini");
+ if (uidmap_plugin_fini == NULL) {
gf_log(xltrname, GF_LOG_CRITICAL,
- "plugin missing fini: %s", dlerror());
+ "plugin missing fini: %s", dlerror());
goto close_it;
}
- if ((plugin_init = (init_fn) dlsym(handle, "init")) == NULL) {
+ plugin_init = (init_fn) dlsym(handle, "init");
+ if (plugin_init == NULL) {
gf_log(xltrname, GF_LOG_CRITICAL,
- "plugin missing init: %s", dlerror());
+ "plugin missing init: %s", dlerror());
}
close_it:
if (dlclose(handle)) {
gf_log(xltrname, CFS_LOG_LEVEL,
- "dlclose plugin: %s", dlerror());
+ "dlclose plugin: %s", dlerror());
}
if (plugin_path != libname) {
GF_FREE(plugin_path);
}
- return plugin_init;
+ return plugin_init;
}
int32_t
init(xlator_t *this)
{
- char *uid_range = NULL, *gid_range = NULL;
- char *plugin = NULL;
- init_fn plugin_init = NULL;
- uid_t low_uid = CFS_UID_LOW_DEFAULT;
- uid_t high_uid = CFS_UID_HIGH_DEFAULT;
- gid_t low_gid = CFS_UID_LOW_DEFAULT;
- gid_t high_gid = CFS_UID_HIGH_DEFAULT;
- short root_squash = 0;
- data_t *data;
-
- if (!this)
- return -1;
-
- if (!this->children || this->children->next) {
- gf_log(this->name, GF_LOG_ERROR,
- "uidmap translator requires one subvolume");
- return -1;
- }
- if (!this->parents) {
- gf_log(this->name, GF_LOG_WARNING,
- "dangling volume. check volfile ");
- }
-
- if ((data = dict_get(this->options, "uid-range")) != NULL) {
- uid_range = data_to_str(data);
- if (uid_range != NULL && *uid_range != 0) {
- if (sscanf(uid_range, "%u-%u", &low_uid, &high_uid) == 2) {
- /* uidmap_mapping.uid_low =
- uidmap_mapping.uid_next = low;
- uidmap_mapping.uid_high = hi; */
- } else {
- gf_log(this->name, GF_LOG_ERROR,
- "invalid uid-range in config");
- }
- }
- } else {
- gf_log(this->name, GF_LOG_ERROR,
- "you must specify the uid-range in the config");
- return -1;
- }
-
- if ((data = dict_get(this->options, "gid-range")) != NULL) {
- gid_range = data_to_str(data);
- if (gid_range != NULL && *gid_range != 0) {
- if (sscanf(gid_range, "%u-%u", &low_gid, &high_gid) == 2) {
- /* uidmap_mapping.gid_low =
- uidmap_mapping.gid_next = low;
- uidmap_mapping.gid_high = hi; */
- } else {
- gf_log(this->name, GF_LOG_ERROR,
- "invalid gid-range in config");
- }
- }
- } else {
- gf_log(this->name, GF_LOG_ERROR,
- "you must specify the gid-range in the config");
- return -1;
- }
-
- if ((data = dict_get(this->options, "root-squash")) != NULL) {
- char *rt_sqsh = data_to_str(data);
- if (rt_sqsh != NULL && *rt_sqsh != 0) {
- char* ptr = rt_sqsh;
- for (; *ptr != 0; ptr++)
- *ptr = tolower(*ptr);
- if (strcmp(rt_sqsh, "yes") == 0)
- root_squash = 1;
- }
- }
-
- if ((data = dict_get(this->options, "uidmap-plugin")) != NULL) {
- plugin = data_to_str(data);
- if (plugin != NULL && *plugin != 0) {
- if ((plugin_init = uidmap_loadsharedlib(this->name, plugin)) != NULL) {
- if ((*plugin_init)(this, low_uid, high_uid,
- low_gid, high_gid,
- root_squash) != 0) {
- gf_log(this->name, GF_LOG_CRITICAL,
- "plugin init error");
- }
- }
- }
- }
- if (uidmap_map == NULL) {
- if (uidmap_deserialize_default(this->name, low_uid, high_uid, low_gid, high_gid, root_squash) == -1)
- return -1;
- uidmap_serialize_default(this->name, uidmap_mappings);
- uidmap_map = uidmap_map_default;
- uidmap_revmap = uidmap_revmap_default;
- }
-
- return 0;
+ char *uid_range = NULL, *gid_range = NULL;
+ char *plugin = NULL;
+ init_fn plugin_init = NULL;
+ uid_t low_uid = CFS_UID_LOW_DEFAULT;
+ uid_t high_uid = CFS_UID_HIGH_DEFAULT;
+ gid_t low_gid = CFS_UID_LOW_DEFAULT;
+ gid_t high_gid = CFS_UID_HIGH_DEFAULT;
+ short root_squash = 0;
+ data_t *data;
+
+ if (!this) {
+ return -1;
+ }
+
+ if (!this->children || this->children->next) {
+ gf_log(this->name, GF_LOG_ERROR,
+ "uidmap translator requires one subvolume");
+ return -1;
+ }
+ if (!this->parents) {
+ gf_log(this->name, GF_LOG_WARNING,
+ "dangling volume. check volfile ");
+ }
+
+ data = dict_get(this->options, "uid-range");
+ if (data != NULL) {
+ uid_range = data_to_str(data);
+ if ((uid_range != NULL) && (*uid_range != 0)) {
+ if (sscanf(uid_range, "%u-%u", &low_uid, &high_uid) == 2) {
+ /* uidmap_mapping.uid_low =
+ uidmap_mapping.uid_next = low;
+ uidmap_mapping.uid_high = hi; */
+ } else {
+ gf_log(this->name, GF_LOG_ERROR,
+ "invalid uid-range in config");
+ }
+ }
+ } else {
+ gf_log(this->name, GF_LOG_ERROR,
+ "you must specify the uid-range in the config");
+ return -1;
+ }
+
+ data = dict_get(this->options, "gid-range");
+ if (data != NULL) {
+ gid_range = data_to_str(data);
+ if ((gid_range != NULL) && (*gid_range != 0)) {
+ if (sscanf(gid_range, "%u-%u", &low_gid, &high_gid) == 2) {
+ /* uidmap_mapping.gid_low =
+ uidmap_mapping.gid_next = low;
+ uidmap_mapping.gid_high = hi; */
+ } else {
+ gf_log(this->name, GF_LOG_ERROR,
+ "invalid gid-range in config");
+ }
+ }
+ } else {
+ gf_log(this->name, GF_LOG_ERROR,
+ "you must specify the gid-range in the config");
+ return -1;
+ }
+
+ data = dict_get(this->options, "root-squash");
+ if (data != NULL) {
+ char *rt_sqsh = data_to_str(data);
+ if ((rt_sqsh != NULL) && (*rt_sqsh != 0)) {
+ char* ptr = rt_sqsh;
+ for (; *ptr != 0; ptr++) {
+ *ptr = tolower(*ptr);
+ }
+ if (strcmp(rt_sqsh, "yes") == 0) {
+ root_squash = 1;
+ }
+ }
+ }
+
+ data = dict_get(this->options, "uidmap-plugin");
+ if (data != NULL) {
+ plugin = data_to_str(data);
+ if ((plugin != NULL) && (*plugin != 0)) {
+ plugin_init = uidmap_loadsharedlib(this->name, plugin);
+ if (plugin_init != NULL) {
+ if ((*plugin_init)(this, low_uid, high_uid,
+ low_gid, high_gid,
+ root_squash) != 0) {
+ gf_log(this->name, GF_LOG_CRITICAL,
+ "plugin init error");
+ }
+ }
+ }
+ }
+ if (uidmap_map == NULL) {
+ if (uidmap_deserialize_default(this->name, low_uid, high_uid, low_gid, high_gid, root_squash) == -1) {
+ return -1;
+ }
+ uidmap_serialize_default(this->name, uidmap_mappings);
+ uidmap_map = uidmap_map_default;
+ uidmap_revmap = uidmap_revmap_default;
+ }
+
+ return 0;
}
void
fini(xlator_t *this)
{
- if (!this)
- return;
+ if (!this) {
+ return;
+ }
- if (uidmap_plugin_fini)
- uidmap_plugin_fini(this);
+ if (uidmap_plugin_fini) {
+ uidmap_plugin_fini(this);
+ }
- gf_log(this->name, CFS_LOG_LEVEL, "uidmap translator unloaded");
- return;
+ gf_log(this->name, CFS_LOG_LEVEL, "uidmap translator unloaded");
+ return;
}
struct xlator_fops fops = {
- .lookup = uidmap_lookup,
- .stat = uidmap_stat,
- .fstat = uidmap_fstat,
- .truncate = uidmap_truncate,
- .ftruncate = uidmap_ftruncate,
- .access = uidmap_access,
- .readlink = uidmap_readlink,
- .mknod = uidmap_mknod,
- .mkdir = uidmap_mkdir,
- .unlink = uidmap_unlink,
- .rmdir = uidmap_rmdir,
- .symlink = uidmap_symlink,
- .rename = uidmap_rename,
- .link = uidmap_link,
- .create = uidmap_create,
- .open = uidmap_open,
- .readv = uidmap_readv,
- .writev = uidmap_writev,
- .flush = uidmap_flush,
- .fsync = uidmap_fsync,
- .opendir = uidmap_opendir,
- .readdir = uidmap_readdir,
- .readdirp = uidmap_readdirp,
- .fsyncdir = uidmap_fsyncdir,
- .statfs = uidmap_statfs,
- .setxattr = uidmap_setxattr,
- .getxattr = uidmap_getxattr,
- .removexattr = uidmap_removexattr,
- .lk = uidmap_lk,
- .inodelk = uidmap_inodelk,
- .finodelk = uidmap_finodelk,
- .entrylk = uidmap_entrylk,
- .fentrylk = uidmap_fentrylk,
- /* .rchecksum = uidmap_rchecksum, */
- .xattrop = uidmap_xattrop,
- .fxattrop = uidmap_fxattrop,
- .setattr = uidmap_setattr,
- .fsetattr = uidmap_fsetattr,
- /* .getspec = uidmap_getspec, */
+ .lookup = uidmap_lookup,
+ .stat = uidmap_stat,
+ .fstat = uidmap_fstat,
+ .truncate = uidmap_truncate,
+ .ftruncate = uidmap_ftruncate,
+ .access = uidmap_access,
+ .readlink = uidmap_readlink,
+ .mknod = uidmap_mknod,
+ .mkdir = uidmap_mkdir,
+ .unlink = uidmap_unlink,
+ .rmdir = uidmap_rmdir,
+ .symlink = uidmap_symlink,
+ .rename = uidmap_rename,
+ .link = uidmap_link,
+ .create = uidmap_create,
+ .open = uidmap_open,
+ .readv = uidmap_readv,
+ .writev = uidmap_writev,
+ .flush = uidmap_flush,
+ .fsync = uidmap_fsync,
+ .opendir = uidmap_opendir,
+ .readdir = uidmap_readdir,
+ .readdirp = uidmap_readdirp,
+ .fsyncdir = uidmap_fsyncdir,
+ .statfs = uidmap_statfs,
+ .setxattr = uidmap_setxattr,
+ .getxattr = uidmap_getxattr,
+ .removexattr = uidmap_removexattr,
+ .lk = uidmap_lk,
+ .inodelk = uidmap_inodelk,
+ .finodelk = uidmap_finodelk,
+ .entrylk = uidmap_entrylk,
+ .fentrylk = uidmap_fentrylk,
+ /* .rchecksum = uidmap_rchecksum, */
+ .xattrop = uidmap_xattrop,
+ .fxattrop = uidmap_fxattrop,
+ .setattr = uidmap_setattr,
+ .fsetattr = uidmap_fsetattr,
+ /* .getspec = uidmap_getspec, */
};
struct xlator_cbks cbks = {
};
struct volume_options options[] = {
- { .key = {"uidmap-plugin", "plugin"},
- .type = GF_OPTION_TYPE_PATH,
- },
- { .key = {"root-squash"},
- .type = GF_OPTION_TYPE_STR,
- .value = { "yes", "no"}
- },
- { .key = {"uid-range"},
- .type = GF_OPTION_TYPE_STR,
- },
- { .key = {"gid-range"},
- .type = GF_OPTION_TYPE_STR,
- },
- { .key = {NULL} },
+ { .key = {"uidmap-plugin", "plugin"},
+ .type = GF_OPTION_TYPE_PATH,
+ },
+ { .key = {"root-squash"},
+ .type = GF_OPTION_TYPE_STR,
+ .value = { "yes", "no"}
+ },
+ { .key = {"uid-range"},
+ .type = GF_OPTION_TYPE_STR,
+ },
+ { .key = {"gid-range"},
+ .type = GF_OPTION_TYPE_STR,
+ },
+ { .key = {NULL} },
};
More information about the cloudfs-devel
mailing list