Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
21c056f5
Commit
21c056f5
authored
12 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Use uint64_t instead of dev_t as well + added comment explaining this
parent
cabb5529
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dir_scan.c
+4
-4
4 additions, 4 deletions
src/dir_scan.c
src/global.h
+11
-9
11 additions, 9 deletions
src/global.h
with
15 additions
and
13 deletions
src/dir_scan.c
+
4
−
4
View file @
21c056f5
...
...
@@ -43,14 +43,14 @@
int
dir_scan_smfs
;
/* Stay on the same filesystem */
static
dev
_t
curdev
;
/* current device we're scanning on */
static
uint64
_t
curdev
;
/* current device we're scanning on */
/* Populates the struct dir item with information from the stat struct. Sets
* everything necessary for output_dir.item() except FF_ERR and FF_EXL. */
static
void
stat_to_dir
(
struct
dir
*
d
,
struct
stat
*
fs
)
{
d
->
ino
=
(
uint64_t
)
fs
->
st_ino
;
d
->
dev
=
fs
->
st_dev
;
d
->
dev
=
(
uint64_t
)
fs
->
st_dev
;
if
(
S_ISREG
(
fs
->
st_mode
))
d
->
flags
|=
FF_FILE
;
...
...
@@ -60,7 +60,7 @@ static void stat_to_dir(struct dir *d, struct stat *fs) {
if
(
!
S_ISDIR
(
fs
->
st_mode
)
&&
fs
->
st_nlink
>
1
)
d
->
flags
|=
FF_HLNKC
;
if
(
dir_scan_smfs
&&
curdev
!=
fs
->
st_
dev
)
if
(
dir_scan_smfs
&&
curdev
!=
d
->
dev
)
d
->
flags
|=
FF_OTHFS
;
if
(
!
(
d
->
flags
&
(
FF_OTHFS
|
FF_EXL
)))
{
...
...
@@ -254,7 +254,7 @@ int dir_scan_process() {
}
if
(
!
dir_fatalerr
)
{
curdev
=
fs
.
st_dev
;
curdev
=
(
uint64_t
)
fs
.
st_dev
;
d
=
dir_createstruct
(
dir_curpath
);
if
(
fail
)
d
->
flags
|=
FF_ERR
;
...
...
This diff is collapsed.
Click to expand it.
src/global.h
+
11
−
9
View file @
21c056f5
...
...
@@ -55,25 +55,27 @@
#define ST_HELP 3
/* structure representing a file or directory
* XXX: probably a good idea to get rid of the custom _t types and use
* fixed-size integers instead, which are much more predictable */
/* structure representing a file or directory */
struct
dir
{
struct
dir
*
parent
,
*
next
,
*
prev
,
*
sub
,
*
hlnk
;
int64_t
size
,
asize
;
uint64_t
ino
;
uint64_t
ino
,
dev
;
int
items
;
dev_t
dev
;
unsigned
char
flags
;
char
name
[
3
];
/* must be large enough to hold ".." */
};
/* sizeof(total dir) = SDIRSIZE + strlen(name) = sizeof(struct dir) - 3 + strlen(name) + 1 */
#define SDIRSIZE (sizeof(struct dir)-2)
/* Ideally, the name array should be as large as the padding added to the end of
* the struct, but I can't figure out a portable way to calculate this. We can
* be sure that it's at least 3 bytes, though, as the struct is aligned to at
* least 4 bytes and the flags field is a single byte. */
/* A note on the ino and dev fields above: ino is usually represented as ino_t,
* which POSIX specifies to be an unsigned integer. dev is usually represented
* as dev_t, which may be either a signed or unsigned integer, and in practice
* both are used. dev represents an index / identifier of a device or
* filesystem, and I'm unsure whether a negative value has any meaning in that
* context. Hence my choice of using an unsigned integer. Negative values, if
* we encounter them, will just get typecasted into a positive value. No
* information is lost in this conversion, and the semantics remain the same.
*/
/* program state */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment