-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathutilities.cpp
executable file
·650 lines (592 loc) · 25.4 KB
/
utilities.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
#include "blobfuse.h"
#include <FileLockMap.h>
#include <sys/file.h>
#include <BlobfuseGlobals.h>
#include <include/StorageBfsClientBase.h>
extern std::shared_ptr<StorageBfsClientBase> storage_client;
int azs_rename_directory(const char *src, const char *dst);
int map_errno(int error)
{
auto mapping = error_mapping.find(error);
if (mapping == error_mapping.end())
{
syslog(LOG_INFO, "Failed to map storage error code %d to a proper errno. Returning EIO = %d instead.\n", error, EIO);
return EIO;
}
else
{
return mapping->second;
}
}
std::string prepend_mnt_path_string(const std::string &path)
{
std::string result;
result.reserve(config_options.tmpPath.length() + 5 + path.length());
return result.append(config_options.tmpPath).append("/root").append(path);
}
// Acquire shared lock utility function
int shared_lock_file(int flags, int fd)
{
if ((flags & O_NONBLOCK) == O_NONBLOCK)
{
if (0 != flock(fd, LOCK_SH | LOCK_NB))
{
int flockerrno = errno;
if (flockerrno == EWOULDBLOCK)
{
AZS_DEBUGLOGV("Failure to acquire flock due to EWOULDBLOCK. fd = %d.", fd);
}
else
{
syslog(LOG_ERR, "Failure to acquire flock for fd = %d. errno = %d", fd, flockerrno);
}
close(fd);
return 0 - flockerrno;
}
}
else
{
if (0 != flock(fd, LOCK_SH))
{
int flockerrno = errno;
syslog(LOG_ERR, "Failure to acquire flock for fd = %d. errno = %d", fd, flockerrno);
close(fd);
return 0 - flockerrno;
}
}
return 0;
}
bool is_directory_blob(unsigned long long size, std::vector<std::pair<std::string, std::string>> metadata)
{
if (size == 0)
{
for (auto iter = metadata.begin(); iter != metadata.end(); ++iter)
{
if ((iter->first.compare("hdi_isfolder") == 0) && (iter->second.compare("true") == 0))
{
return true;
}
}
}
return false;
}
int ensure_files_directory_exists_in_cache(const std::string &file_path)
{
char *pp;
char *slash;
int status;
char *copypath = strdup(file_path.c_str());
status = 0;
errno = 0;
pp = copypath;
while (status == 0 && (slash = strchr(pp, '/')) != 0)
{
if (slash != pp)
{
*slash = '\0';
AZS_DEBUGLOGV("Making cache directory %s.\n", copypath);
struct stat st;
if (stat(copypath, &st) != 0)
{
status = mkdir(copypath, config_options.defaultPermission);
}
// Ignore if some other thread was successful creating the path
if (errno == EEXIST)
{
status = 0;
errno = 0;
}
*slash = '/';
}
pp = slash + 1;
}
free(copypath);
return status;
}
int azs_getattr(const char *path, struct stat *stbuf)
{
AZS_DEBUGLOGV("azs_getattr called with path = %s\n", path);
// If we're at the root, we know it's a directory
if (strlen(path) == 1)
{
stbuf->st_mode = S_IFDIR | config_options.defaultPermission; // TODO: proper access control.
stbuf->st_uid = fuse_get_context()->uid;
stbuf->st_gid = fuse_get_context()->gid;
stbuf->st_nlink = 2; // Directories should have a hard-link count of 2 + (# child directories). We don't have that count, though, so we just use 2 for now. TODO: Evaluate if we could keep this accurate or not.
stbuf->st_size = 4096;
stbuf->st_mtime = globalTimes.lastModifiedTime;
stbuf->st_atime = globalTimes.lastAccessTime;
stbuf->st_ctime = globalTimes.lastChangeTime;
return 0;
}
// Check and see if the file/directory exists locally (because it's being buffered.) If so, skip the call to Storage.
std::string pathString(path);
// Replace '\' with '/' as for azure storage they will be considered as path seperators
std::replace(pathString.begin(), pathString.end(), '\\', '/');
std::string mntPathString = prepend_mnt_path_string(pathString);
int res;
int acc = access(mntPathString.c_str(), F_OK);
if (acc != -1)
{
AZS_DEBUGLOGV("Accessing mntPath = %s for getattr succeeded; object is in the local cache.\n", mntPathString.c_str());
// Ensure that we don't get attributes while the file is in an intermediate state.
bool file_locked = false;
if (config_options.backgroundDownload) {
// Wait untill the download has finished
auto dmutex = file_lock_map::get_instance()->get_delay_mutex(pathString.substr(1).c_str());
if (dmutex->try_lock()) {
dmutex->unlock();
} else {
// File is still under download so we can not flush at this moment
// However some time immeidatly after open also we get a flush call, so no need to block it here
syslog(LOG_DEBUG, "lstat on file %s ignored as file is locked\n", mntPathString.c_str());
file_locked = true;
}
} else {
std::shared_ptr<std::mutex> fmutex = file_lock_map::get_instance()->get_mutex(pathString.c_str());
if ((*fmutex).try_lock()) {
// File is not locked so we can use the cache directory
(*fmutex).unlock();
} else {
// File is locked so it may be under download, not a good time to refer local cache
file_locked = true;
syslog(LOG_DEBUG, "lstat on file %s ignored as file is locked\n", mntPathString.c_str());
}
}
if (!file_locked) {
res = lstat(mntPathString.c_str(), stbuf);
if (res == -1)
{
int lstaterrno = errno;
syslog(LOG_ERR, "lstat on file %s in local cache during getattr failed with errno = %d.\n", mntPathString.c_str(), lstaterrno);
return -lstaterrno;
}
else
{
char real_path[PATH_MAX];
char *result = realpath(mntPathString.c_str(), real_path);
if (result != NULL) {
// Path got resolved. lets check we are not moving away from temp path
// If the file name was created using some special characters then merging it with temp cache path
// may lead the path out of the temp cache folder and blobfuse may end up touching those files if open is hit
// To restrict that here we stop getattr and return enoent so that open is never called for such path
// any absolute path going out of temp cache path needs to be invalidated
std::string realPathString(real_path);
if (std::string::npos == realPathString.find(config_options.absoluteTmpPath)) {
AZS_DEBUGLOGV("Resolved absolute path is = %s for %s, and its out of scope\n", real_path, mntPathString.c_str());
return -(ENOENT);
}
}
AZS_DEBUGLOGV("lstat on file %s in local cache succeeded.\n", mntPathString.c_str());
return 0;
}
}
}
else
{
AZS_DEBUGLOGV("Object %s is not in the local cache during getattr.\n", mntPathString.c_str());
}
// It's not in the local cache. Check to see if it's a blob on the service:
std::string blobNameStr(pathString.substr(1).c_str());
if (blobNameStr == ".Trash" ||
blobNameStr == ".Trash-1000" ||
blobNameStr == ".xdg-volume-info" ||
blobNameStr == "autorun.inf") {
syslog(LOG_DEBUG, "Ignoring %s in getattr", blobNameStr.c_str());
return -(ENOENT);
}
errno = 0;
//AZS_DEBUGLOGV("Storage client name is %s \n", (typeid(storage_client).name()));
// see if it is block blob and call the block blob method
//if the first task is to study
if (!storage_client->isADLS())
{
if (config_options.useAttrCache)
{
// If attr-cache is enable then instead of calling list
// get the attributes from cache for file. for dir we will still
// rely on list apis.
BfsFileProperty file_property = storage_client->GetFileProperties(blobNameStr, true);
if (file_property.isValid() && file_property.exists())
{
if (file_property.is_symlink ||
is_symlink_blob(file_property.metadata))
{
stbuf->st_mode = S_IFLNK | config_options.defaultPermission;
}
else
{
stbuf->st_mode = S_IFREG | config_options.defaultPermission;
}
stbuf->st_uid = fuse_get_context()->uid;
stbuf->st_gid = fuse_get_context()->gid;
stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime = file_property.get_last_modified();
stbuf->st_nlink = 1;
stbuf->st_size = file_property.get_size();
AZS_DEBUGLOGV("File Prop Cache : size is %llu ", file_property.get_size());
return 0;
}
}
// though we want atmost 2 results set the count to high, we will exit as soon as we finf the file.
int resultCount = 5000;
const int maxFailCount = 20;
bool success = false;
int failcount = 0;
list_segmented_response response;
list_segmented_item blobItem;
std::string continuation = "";
std::string delimiter = "/";
do
{
response.reset();
//reset success to false for each call
success = false;
blobItem = {};
// we are only listing directories, lexicographical return is failing when we set max_result to 2 so setting it higher.
storage_client->List(continuation, blobNameStr, delimiter, response, resultCount);
continuation = response.m_next_marker;
AZS_DEBUGLOGV("In azs_getattr list_segmented_item do loop blob prefix: %s continuation: %s", blobNameStr.c_str(),continuation.c_str());
if (errno == 404) {
syslog(LOG_WARNING, "File does not currently exist on the storage or cache, errno : %d", errno);
response.reset();
return -(ENOENT);
} else if (errno == 403) {
syslog(LOG_WARNING, "User does not have permission to access this resource, errno : %d", errno);
response.reset();
return -(EPERM);
} else if (errno != 0) {
syslog(LOG_WARNING, "Failed to get info on %s, errno : %d",
blobNameStr.c_str(), errno);
success = false;
failcount++;
continue;
}
unsigned int dirSize = 0;
for (unsigned int i = 0; i < response.m_items.size(); i++)
{
AZS_DEBUGLOGV("In azs_getattr list_segmented_item %d file %s\n", i, response.m_items[i].name.c_str());
// if the path for exact name is found the dirSize will be 1 here so check to see if it has files or subdirectories inside
// match dir name or longer paths to determine dirSize
if (response.m_items[i].name.compare(blobNameStr + '/') < 0)
{
dirSize++;
// listing is not always lexicographical for service errors
if (dirSize > 2 && !blobItem.name.empty())
{
break;
}
}
// the below will be skipped blobItem has been found already because we only need the exact match
// find the element with the exact prefix
// this could lead to a bug when there is a file with the same name as the directory in the parent directory. In short, that won't work.
if (blobItem.name.empty() && (response.m_items[i].name == blobNameStr ||
response.m_items[i].name == (blobNameStr + '/')))
{
blobItem = response.m_items[i];
//set success =true since we found blob or virtual directory
success = true;
AZS_DEBUGLOGV("In azs_getattr found blob in list file %s\n", blobItem.name.c_str());
// leave 'i' at the value it is, it will be used in the remaining batches and loops to check for directory empty check.
if (dirSize == 0 && (is_directory_blob(0, blobItem.metadata) || blobItem.is_directory || blobItem.name == (blobNameStr + '/')))
{
dirSize = 1; // root directory exists so 1
}
}
}
if (!blobItem.name.empty())
{
if (!blobItem.last_modified.empty()) {
struct tm mtime;
char *ptr = strptime(blobItem.last_modified.c_str(), "%a, %d %b %Y %H:%M:%S", &mtime);
if (ptr) {
stbuf->st_mtime = timegm(&mtime);
stbuf->st_atime = stbuf->st_ctime = stbuf->st_mtime;
}
}
stbuf->st_uid = fuse_get_context()->uid;
stbuf->st_gid = fuse_get_context()->gid;
if (blobItem.is_directory || is_directory_blob(0, blobItem.metadata))
{
//AZS_DEBUGLOGV("%s is a directory, blob name is %s\n", mntPathString.c_str(), blobItem.name.c_str());
AZS_DEBUGLOGV("Blob %s, representing a directory, found during get_attr.\n", path);
stbuf->st_mode = S_IFDIR | config_options.defaultPermission;
// If st_nlink = 2, means directory is empty.
// Directory size will affect behaviour for mv, rmdir, cp etc.
// assign directory status as empty or non-empty based on the value from above
stbuf->st_nlink = dirSize > 1 ? 3 : 2;
stbuf->st_size = 4096;
response.reset();
return 0;
}
else
{
//AZS_DEBUGLOGV("%s is a file, blob name is %s\n", mntPathString.c_str(), blobItem.name.c_str());
AZS_DEBUGLOGV("Blob %s, representing a file, found during get_attr.\n", path);
mode_t perms = config_options.defaultPermission;
if (is_symlink_blob(blobItem.metadata)) {
stbuf->st_mode = S_IFLNK | perms;
} else {
stbuf->st_mode = S_IFREG | perms; // Regular file (not a directory)
}
stbuf->st_size = blobItem.content_length;
stbuf->st_nlink = 1;
response.reset();
return 0;
}
}
} while(!success && !continuation.empty() && failcount < maxFailCount);
if (errno > 0)
{
int storage_errno = errno;
AZS_DEBUGLOGV("Failure when attempting to determine if %s exists on the service. errno = %d.\n", blobNameStr.c_str(), storage_errno);
syslog(LOG_ERR, "Failure when attempting to determine if %s exists on the service. errno = %d.\n", blobNameStr.c_str(), storage_errno);
response.reset();
return 0 - map_errno(storage_errno);
}
else // it is a new blob
{
AZS_DEBUGLOGV("%s not returned in list_segmented_blobs. It is a new blob", blobNameStr.c_str());
response.reset();
return -(ENOENT);
}
} // end of processing for Blockblob
else
{
BfsFileProperty blob_property = storage_client->GetProperties(blobNameStr);
mode_t perms = blob_property.m_file_mode == 0 ? config_options.defaultPermission : blob_property.m_file_mode;
if ((errno == 0) && blob_property.isValid() && blob_property.exists())
{
if (blob_property.is_directory)
{
AZS_DEBUGLOGV("Blob %s, representing a directory, found during get_attr.\n", path);
stbuf->st_mode = S_IFDIR | perms;
// If st_nlink = 2, means directory is empty.
// Directory size will affect behaviour for mv, rmdir, cp etc.
stbuf->st_uid = fuse_get_context()->uid;
stbuf->st_gid = fuse_get_context()->gid;
stbuf->st_nlink = storage_client->IsDirectoryEmpty(blobNameStr.c_str()) == D_EMPTY ? 2 : 3;
stbuf->st_size = 4096;
stbuf->st_mtime = blob_property.get_last_modified();
stbuf->st_atime = blob_property.get_last_access();
stbuf->st_ctime = blob_property.get_last_change();
return 0;
}
AZS_DEBUGLOGV("Blob %s, representing a file, found during get_attr.\n", path);
if (blob_property.is_symlink ||
is_symlink_blob(blob_property.metadata))
{
stbuf->st_mode = S_IFLNK | perms;
}
else
{
stbuf->st_mode = S_IFREG | perms; // Regular file (not a directory)
}
stbuf->st_uid = fuse_get_context()->uid;
stbuf->st_gid = fuse_get_context()->gid;
stbuf->st_mtime = blob_property.get_last_modified();
stbuf->st_atime = blob_property.get_last_access();
stbuf->st_ctime = blob_property.get_last_change();
stbuf->st_nlink = 1;
stbuf->st_size = blob_property.get_size();
return 0;
}
else if (errno == 0 && !blob_property.isValid() && blob_property.exists())
{
// Check to see if it's a directory, instead of a file
errno = 0;
int dirSize = is_directory_blob(blob_property.get_size(), blob_property.metadata);
if (errno != 0)
{
int storage_errno = errno;
syslog(LOG_ERR, "Failure when attempting to determine if directory %s exists on the service. errno = %d.\n", blobNameStr.c_str(), storage_errno);
return 0 - map_errno(storage_errno);
}
if (dirSize != D_NOTEXIST)
{
AZS_DEBUGLOGV("Directory %s found on the service.\n", blobNameStr.c_str());
stbuf->st_mode = S_IFDIR | config_options.defaultPermission;
// If st_nlink = 2, means directory is empty.
// Directory size will affect behaviour for mv, rmdir, cp etc.
stbuf->st_uid = fuse_get_context()->uid;
stbuf->st_gid = fuse_get_context()->gid;
stbuf->st_nlink = dirSize == D_EMPTY ? 2 : 3;
stbuf->st_size = 4096;
stbuf->st_mtime = time(NULL);
return 0;
}
else
{
AZS_DEBUGLOGV("Entity %s does not exist. Returning ENOENT (%d) from get_attr.\n", path, ENOENT);
return -(ENOENT);
}
}
else
{
if (errno == 404 || !blob_property.exists())
{
// The file does not currently exist on the service or in the cache
// If the command they are calling is just checking for existence, fuse will call the next operation
// dependent on this error number. If the command cannot continue without the existence it will print out
// the correct error to the user.
syslog(LOG_WARNING, "File does not currently exist on the storage or cache");
return -(ENOENT);
} else if (errno == 403) {
syslog(LOG_WARNING, "Current user does not have permission to access this file");
return -(EPERM);
}
// If we received a different error, then let's fail with that error
int storage_errno = errno;
AZS_DEBUGLOGV("Failure when attempting to determine if %s exists on the service. errno = %d.\n", blobNameStr.c_str(), storage_errno);
syslog(LOG_ERR, "Failure when attempting to determine if %s exists on the service. errno = %d.\n", blobNameStr.c_str(), storage_errno);
return 0 - map_errno(storage_errno);
}
}
}
// Helper method for FTW to remove an entire directory & it's contents.
int rm(const char *fpath, const struct stat * /*sb*/, int tflag, struct FTW * /*ftwbuf*/)
{
if (tflag == FTW_DP)
{
errno = 0;
int ret = rmdir(fpath);
return ret;
}
else
{
errno = 0;
int ret = unlink(fpath);
return ret;
}
}
// Delete the entire contents of tmpPath.
void azs_destroy(void * /*private_data*/)
{
AZS_DEBUGLOG("azs_destroy called.\n");
std::string rootPath(config_options.tmpPath + "/root");
errno = 0;
// FTW_DEPTH instructs FTW to do a post-order traversal (children of a directory before the actual directory.)
nftw(rootPath.c_str(), rm, 20, FTW_DEPTH);
}
// Not yet implemented section:
int azs_access(const char * /*path*/, int /*mask*/)
{
return 0; // permit all access
}
int azs_fsync(const char * path, int /*isdatasync*/, struct fuse_file_info *fi)
{
if (config_options.invalidateOnSync) {
syslog(LOG_INFO, "FSYNC : Request for forceful eviction of file : %s", path);
struct fhwrapper *fhw = ((struct fhwrapper *)fi->fh);
storage_client->InvalidateFile(fhw->file_name);
SET_FHW_FLAG(fhw->flags, FILE_FORCE_DELETE);
}
return 0;
}
int azs_fsyncdir(const char *path, int, struct fuse_file_info *)
{
if (config_options.invalidateOnSync) {
syslog(LOG_INFO, "FSYNC : Request for forceful invalidation of directory : %s", path);
std::string pathString(path);
storage_client->InvalidateDir(pathString.substr(1));
}
return 0;
}
int azs_chown(const char * /*path*/, uid_t /*uid*/, gid_t /*gid*/)
{
//TODO: is it ok to change ownership if it is ADLS. Should blbofuse allow this?
// Block blob should allow changing ownership.
return 0;
}
int azs_chmod(const char *path, mode_t mode)
{
//This is only functional when --use-adls is enabled as a mount flag
AZS_DEBUGLOGV("azs_chmod called with path = %s, mode = %o.\n", path, mode);
std::string pathString(path);
std::replace(pathString.begin(), pathString.end(), '\\', '/');
errno = 0;
int ret = storage_client->ChangeMode(pathString.c_str(), mode);
if (ret)
{
AZS_DEBUGLOGV("azs_chmod failed for path = %s, mode = %o.\n", path, mode);
return ret;
}
return 0;
}
//#ifdef HAVE_UTIMENSAT
int azs_utimens(const char * /*path*/, const struct timespec[2] /*ts[2]*/)
{
//TODO: Implement
// return -ENOSYS;
return 0;
}
// #endif
// TODO: Fix bug where the files and directories in the source in the file cache are not deleted.
// TODO: Fix bugs where the a file has been created but not yet uploaded.
// TODO: Fix the bug where this fails for multi-level dirrectories.
// TODO: If/when we upgrade to FUSE 3.0, we will need to worry about the additional possible flags (RENAME_EXCHANGE and RENAME_NOREPLACE)
int azs_rename(const char *src, const char *dst)
{
AZS_DEBUGLOGV("azs_rename called with src = %s, dst = %s.\n", src, dst);
std::string fromStr(src);
std::replace(fromStr.begin(), fromStr.end(), '\\', '/');
std::string toStr(dst);
std::replace(toStr.begin(), toStr.end(), '\\', '/');
errno = 0;
struct stat stbuf;
errno = azs_getattr(fromStr.c_str(), &stbuf);
if (errno != 0)
return errno;
std::vector<std::string> to_remove;
if (storage_client->isADLS()) {
to_remove = storage_client->Rename(fromStr.c_str(), toStr.c_str());
} else {
if (stbuf.st_mode & S_IFDIR) {
// Rename a directory
to_remove = storage_client->Rename(fromStr.c_str(), toStr.c_str(), true);
} else {
// Rename a file
to_remove = storage_client->Rename(fromStr.c_str(), toStr.c_str(), false);
}
}
if (errno != 0 ) {
syslog(LOG_ERR, "Failed to rename %s, err : %d", fromStr.c_str(), errno);
return 0 - map_errno(errno);
}
for (unsigned int i = 0; i < to_remove.size(); i++)
{
struct stat buf;
if (0 == stat(to_remove.at(i).c_str(), &buf))
g_gc_cache->addCacheBytes(fromStr.c_str(), buf.st_size);
g_gc_cache->uncache_file(to_remove.at(i));
}
return 0;
}
int azs_setxattr(const char * /*path*/, const char * /*name*/, const char * /*value*/, size_t /*size*/, int /*flags*/)
{
return -ENOSYS;
}
int azs_getxattr(const char * /*path*/, const char * /*name*/, char * /*value*/, size_t /*size*/)
{
return -ENOSYS;
}
int azs_listxattr(const char * /*path*/, char * /*list*/, size_t /*size*/)
{
return -ENOSYS;
}
int azs_removexattr(const char * /*path*/, const char * /*name*/)
{
return -ENOSYS;
}
bool is_symlink_blob(std::vector<std::pair<std::string, std::string>> metadata)
{
for (auto iter = metadata.begin(); iter != metadata.end(); ++iter)
{
if (((iter->first.compare("is_symlink") == 0) ||
(iter->first.compare("Is_symlink") == 0)) &&
(iter->second.compare("true") == 0))
{
return true;
}
}
return false;
}