Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
c4b4df4f
Commit
c4b4df4f
authored
Jan 08, 2004
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimized the sending of dev+inode data for hard-linking support
(but only when speaking protocol 28).
parent
a6d89d18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
11 deletions
+34
-11
flist.c
flist.c
+32
-9
hlink.c
hlink.c
+2
-2
No files found.
flist.c
View file @
c4b4df4f
...
...
@@ -360,6 +360,7 @@ static void send_file_entry(struct file_struct *file, int f,
static
DEV64_T
last_rdev
;
static
uid_t
last_uid
;
static
gid_t
last_gid
;
static
DEV64_T
last_dev
;
static
char
lastname
[
MAXPATHLEN
];
char
*
fname
,
fbuf
[
MAXPATHLEN
];
int
l1
,
l2
;
...
...
@@ -407,6 +408,15 @@ static void send_file_entry(struct file_struct *file, int f,
flags
|=
SAME_TIME
;
else
last_time
=
file
->
modtime
;
if
(
file
->
flags
&
HAS_INODE_DATA
)
{
if
(
file
->
dev
==
last_dev
)
{
if
(
protocol_version
>=
28
)
flags
|=
SAME_DEV
;
}
else
last_dev
=
file
->
dev
;
flags
|=
HAS_INODE_DATA
;
}
for
(
l1
=
0
;
lastname
[
l1
]
&&
(
fname
[
l1
]
==
lastname
[
l1
])
&&
(
l1
<
255
);
...
...
@@ -471,14 +481,15 @@ static void send_file_entry(struct file_struct *file, int f,
#endif
#if SUPPORT_HARD_LINKS
if
(
preserve_hard_links
&&
S_ISREG
(
file
->
mode
)
)
{
if
(
flags
&
HAS_INODE_DATA
)
{
if
(
protocol_version
<
26
)
{
/* 32-bit dev_t and ino_t */
write_int
(
f
,
(
int
)
file
->
dev
);
write_int
(
f
,
(
int
)
file
->
inode
);
write_int
(
f
,
last_
dev
);
write_int
(
f
,
file
->
inode
);
}
else
{
/* 64-bit dev_t and ino_t */
write_longint
(
f
,
file
->
dev
);
if
(
!
(
flags
&
SAME_DEV
))
write_longint
(
f
,
last_dev
);
write_longint
(
f
,
file
->
inode
);
}
}
...
...
@@ -507,6 +518,7 @@ static void receive_file_entry(struct file_struct **fptr,
static
DEV64_T
last_rdev
;
static
uid_t
last_uid
;
static
gid_t
last_gid
;
static
DEV64_T
last_dev
;
static
char
lastname
[
MAXPATHLEN
];
char
thisname
[
MAXPATHLEN
];
unsigned
int
l1
=
0
,
l2
=
0
;
...
...
@@ -617,14 +629,19 @@ static void receive_file_entry(struct file_struct **fptr,
sanitize_path
(
file
->
link
,
file
->
dirname
);
}
#if SUPPORT_HARD_LINKS
if
(
preserve_hard_links
&&
S_ISREG
(
file
->
mode
))
{
if
(
preserve_hard_links
&&
protocol_version
<
28
&&
S_ISREG
(
last_mode
))
file
->
flags
|=
HAS_INODE_DATA
;
if
(
file
->
flags
&
HAS_INODE_DATA
)
{
if
(
protocol_version
<
26
)
{
file
->
dev
=
read_int
(
f
);
last_
dev
=
read_int
(
f
);
file
->
inode
=
read_int
(
f
);
}
else
{
file
->
dev
=
read_longint
(
f
);
if
(
!
(
flags
&
SAME_DEV
))
last_dev
=
read_longint
(
f
);
file
->
inode
=
read_longint
(
f
);
}
file
->
dev
=
last_dev
;
}
#endif
...
...
@@ -780,8 +797,14 @@ struct file_struct *make_file(char *fname, struct string_area **ap,
file
->
mode
=
st
.
st_mode
;
file
->
uid
=
st
.
st_uid
;
file
->
gid
=
st
.
st_gid
;
file
->
dev
=
st
.
st_dev
;
file
->
inode
=
st
.
st_ino
;
if
(
preserve_hard_links
)
{
if
(
protocol_version
<
28
?
S_ISREG
(
st
.
st_mode
)
:
!
S_ISDIR
(
st
.
st_mode
)
&&
st
.
st_nlink
>
1
)
{
file
->
dev
=
st
.
st_dev
;
file
->
inode
=
st
.
st_ino
;
file
->
flags
|=
HAS_INODE_DATA
;
}
}
#ifdef HAVE_STRUCT_STAT_ST_RDEV
file
->
rdev
=
st
.
st_rdev
;
#endif
...
...
hlink.c
View file @
c4b4df4f
...
...
@@ -62,7 +62,7 @@ void init_hard_links(struct file_list *flist)
*/
hlink_count
=
0
;
for
(
i
=
0
;
i
<
flist
->
count
;
i
++
)
{
if
(
S_ISREG
(
flist
->
files
[
i
]
->
mode
)
)
if
(
flist
->
files
[
i
]
->
flags
&
HAS_INODE_DATA
)
hlink_list
[
hlink_count
++
]
=
flist
->
files
[
i
];
}
...
...
@@ -86,7 +86,7 @@ int check_hard_link(struct file_struct *file)
int
low
=
0
,
high
=
hlink_count
-
1
;
int
ret
=
0
;
if
(
!
hlink_list
||
!
S_ISREG
(
file
->
mode
))
if
(
!
hlink_list
||
!
(
file
->
flags
&
HAS_INODE_DATA
))
return
0
;
while
(
low
!=
high
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment