Whamcloud - gitweb
LU-18027 lfs: lfs find handling special files
This replaces fget_projid() with get_projid(),
a newer function that is able to get project ids on
regular files, directories, symbolic links, and
special file types. This adopts the same approach to
getting file attributes that lfs_project.c uses in
project_get_fsxattr() by getting a special file's
attributes by the containing directory.
This patch also replaces the exclusion logic for
the --projid flag, reducing the depth count of if/else
clauses by checking a boolean equivalence statement.
Boolean algebra table for why this works (skip means
we don't print, include means we do):
matches | exclude_projid | matches == exclude_projid |
------------------------------------------------------
1 | 1 | 1 (skip) |
1 | 0 | 0 (include) |
0 | 1 | 0 (include) |
0 | 0 | 1 (skip) |
Finally, this patch replaces the INVALID_PROJID = -1
definition with DEFAULT_PROJID = 0. A major reason for
this is that projid is defined as an unsigned, 32-bit
integer, so storing a negative value in it doesn't make
much sense. With this patch we should be able to get
the project id for every file type (special or not),
so we no longer need a case for invalid projid.
.gitignore .vscode/settings.json files.
Add test_56ei in sanity.sh that sets a project id
on some special files and checks that lfs find --printf
picks up the file, and prints the correct project
id.
Updates error messages in test_56rd to not assume
we can't get projid from special file types.
Fix bug where we were only printing file types.
HPE-bug-id: LUS-12195
Signed-off-by: Caleb Carlson <caleb.carlson@hpe.com>
Test-Parameters: testlist=sanity
Change-Id: I8b10044ea62d662d6f9388725c0e93d55a43b431
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55709
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: corey tesdahl <corey.tesdahl@hpe.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Sakib Samar <sakib.samar@hpe.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>