} else {
dentry->attributes = FILE_ATTRIBUTE_NORMAL;
}
+ if (sizeof(ino_t) >= 8)
+ dentry->hard_link = (u64)stbuf->st_ino;
+ else
+ dentry->hard_link = (u64)stbuf->st_ino |
+ ((u64)stbuf->st_dev << (sizeof(ino_t) * 8));
}
/* Transfers file attributes from a struct dentry to a `stat' buffer. */
dentry = MALLOC(sizeof(struct dentry));
if (!dentry)
- return NULL;
+ goto err;
dentry_common_init(dentry);
- if (change_dentry_name(dentry, name) != 0) {
- FREE(dentry);
- return NULL;
- }
+ if (change_dentry_name(dentry, name) != 0)
+ goto err;
dentry_update_all_timestamps(dentry);
dentry->next = dentry;
dentry->prev = dentry;
dentry->parent = dentry;
return dentry;
+err:
+ FREE(dentry);
+ ERROR("Failed to allocate new dentry");
+ return NULL;
}
static void dentry_free_ads_entries(struct dentry *dentry)
*file_name_utf8_ret = file_name_utf8;
*file_name_len_ret = utf16_len;
*file_name_utf8_len_ret = utf8_len;
+ return 0;
}
/* Changes the name of a dentry to @new_name. Only changes the file_name and