Lines Matching refs:item
84 static int AddToFstab(Fstab *fstab, FstabItem *item)
86 if (fstab == NULL || item == NULL) {
90 fstab->head = fstab->tail = item;
92 fstab->tail->next = item;
93 fstab->tail = item;
98 void ReleaseFstabItem(FstabItem *item)
100 if (item != NULL) {
101 if (item->deviceName != NULL) {
102 free(item->deviceName);
103 item->deviceName = NULL;
106 if (item->mountPoint != NULL) {
107 free(item->mountPoint);
108 item->mountPoint = NULL;
111 if (item->fsType != NULL) {
112 free(item->fsType);
113 item->fsType = NULL;
116 if (item->mountOptions != NULL) {
117 free(item->mountOptions);
118 item->mountOptions = NULL;
121 free(item);
128 FstabItem *item = fstab->head;
129 while (item != NULL) {
130 FstabItem *tmp = item->next;
131 ReleaseFstabItem(item);
132 item = tmp;
144 FstabItem *item = NULL;
148 if ((item = (FstabItem *)calloc(1, sizeof(FstabItem))) == NULL) {
150 BEGET_LOGE("Allocate memory for FS table item failed, err = %d", errno);
156 item->deviceName = strdup(p);
157 BEGET_ERROR_CHECK(item->deviceName != NULL, break, "strdup deviceName failed.");
160 item->mountPoint = strdup(p);
161 BEGET_ERROR_CHECK(item->mountPoint != NULL, break, "strdup mountPoint failed.");
164 item->fsType = strdup(p);
165 BEGET_ERROR_CHECK(item->fsType != NULL, break, "strdup fsType failed.");
168 item->mountOptions = strdup(p);
169 BEGET_ERROR_CHECK(item->mountOptions != NULL, break, "strdup mountOptions failed.");
178 item->fsManagerFlags = ConvertFlags(p);
180 item->fsManagerFlags = 0;
182 return AddToFstab(fstab, item);
185 ReleaseFstabItem(item);
186 item = NULL;
252 FstabItem *item = NULL;
254 for (item = fstab.head; item != NULL; item = item->next) {
255 if ((item->mountPoint != NULL) && (strcmp(item->mountPoint, mp) == 0)) {
260 return item;
265 FstabItem *item = NULL;
280 item = FindFstabItemForMountPoint(fstab, dir);
281 if (item != NULL) {
290 return item;
321 FstabItem *item = FindFstabItemForMountPoint(*fstab, mountPoint);
322 if (item == NULL) {
323 BEGET_LOGE("Failed to get fstab item from mount point \" %s \"", mountPoint);
326 if (strncpy_s(deviceName, nameLen, item->deviceName, strlen(item->deviceName)) != 0) {
335 for (FstabItem *item = fstab->head; item != NULL; item = item->next) {
336 if (strstr(item->deviceName, deviceName) != NULL) {
337 BEGET_CHECK_RETURN_VALUE(strcpy_s(miscDev, size, item->deviceName) != 0, 0);
461 // If the item configured in fstab contains flag over than 15,
528 static int ParseRequiredMountInfo(const char *item, Fstab *fstab)
533 BEGET_CHECK(!(item == NULL || *item == '\0' || fstab == NULL), return -1);
536 if ((p = strstr(item, "=")) != NULL) {
537 const char *q = item + strlen(OHOS_REQUIRED_MOUNT_PREFIX); // Get partition name
543 return -1, "Failed to copy required mount info: %s", item);