Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
e1579aaf
Commit
e1579aaf
authored
Feb 13, 2014
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "move fnv_64a_buf to utils.c and remove mutliple copies"
Fix clang breakage. This reverts commit
7cd32872
.
parent
7cd32872
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
28 deletions
+58
-28
conf.c
src/lxc/conf.c
+32
-0
monitor.c
src/lxc/monitor.c
+25
-0
utils.c
src/lxc/utils.c
+1
-25
utils.h
src/lxc/utils.h
+0
-3
No files found.
src/lxc/conf.c
View file @
e1579aaf
...
@@ -1119,6 +1119,38 @@ static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
...
@@ -1119,6 +1119,38 @@ static int setup_rootfs_pivot_root(const char *rootfs, const char *pivotdir)
return
0
;
return
0
;
}
}
/*
* Note: This is a verbatum copy of what is in monitor.c. We're just
* usint it here to generate a safe subdirectory in /dev/ for the
* containers /dev/
*/
/* Note we don't use SHA-1 here as we don't want to depend on HAVE_GNUTLS.
* FNV has good anti collision properties and we're not worried
* about pre-image resistance or one-way-ness, we're just trying to make
* the name unique in the 108 bytes of space we have.
*/
#define FNV1A_64_INIT ((uint64_t)0xcbf29ce484222325ULL)
static
uint64_t
fnv_64a_buf
(
void
*
buf
,
size_t
len
,
uint64_t
hval
)
{
unsigned
char
*
bp
;
for
(
bp
=
buf
;
bp
<
(
unsigned
char
*
)
buf
+
len
;
bp
++
)
{
/* xor the bottom with the current octet */
hval
^=
(
uint64_t
)
*
bp
;
/* gcc optimised:
* multiply by the 64 bit FNV magic prime mod 2^64
*/
hval
+=
(
hval
<<
1
)
+
(
hval
<<
4
)
+
(
hval
<<
5
)
+
(
hval
<<
7
)
+
(
hval
<<
8
)
+
(
hval
<<
40
);
}
return
hval
;
}
/*
/*
* Check to see if a directory has something mounted on it and,
* Check to see if a directory has something mounted on it and,
* if it does, return the fstype.
* if it does, return the fstype.
...
...
src/lxc/monitor.c
View file @
e1579aaf
...
@@ -123,6 +123,31 @@ int lxc_monitor_close(int fd)
...
@@ -123,6 +123,31 @@ int lxc_monitor_close(int fd)
return
close
(
fd
);
return
close
(
fd
);
}
}
/* Note we don't use SHA-1 here as we don't want to depend on HAVE_GNUTLS.
* FNV has good anti collision properties and we're not worried
* about pre-image resistance or one-way-ness, we're just trying to make
* the name unique in the 108 bytes of space we have.
*/
#define FNV1A_64_INIT ((uint64_t)0xcbf29ce484222325ULL)
static
uint64_t
fnv_64a_buf
(
void
*
buf
,
size_t
len
,
uint64_t
hval
)
{
unsigned
char
*
bp
;
for
(
bp
=
buf
;
bp
<
(
unsigned
char
*
)
buf
+
len
;
bp
++
)
{
/* xor the bottom with the current octet */
hval
^=
(
uint64_t
)
*
bp
;
/* gcc optimised:
* multiply by the 64 bit FNV magic prime mod 2^64
*/
hval
+=
(
hval
<<
1
)
+
(
hval
<<
4
)
+
(
hval
<<
5
)
+
(
hval
<<
7
)
+
(
hval
<<
8
)
+
(
hval
<<
40
);
}
return
hval
;
}
int
lxc_monitor_sock_name
(
const
char
*
lxcpath
,
struct
sockaddr_un
*
addr
)
{
int
lxc_monitor_sock_name
(
const
char
*
lxcpath
,
struct
sockaddr_un
*
addr
)
{
size_t
len
;
size_t
len
;
int
ret
;
int
ret
;
...
...
src/lxc/utils.c
View file @
e1579aaf
...
@@ -245,7 +245,7 @@ const char *lxc_global_config_value(const char *option_name)
...
@@ -245,7 +245,7 @@ const char *lxc_global_config_value(const char *option_name)
{
NULL
,
NULL
},
{
NULL
,
NULL
},
};
};
/* placed in the thread local storage pool for non-bionic targets */
/* placed in the thread local storage pool for non-bionic targets */
#ifdef HAVE_TLS
#ifdef HAVE_TLS
static
__thread
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
static
__thread
const
char
*
values
[
sizeof
(
options
)
/
sizeof
(
options
[
0
])]
=
{
0
};
#else
#else
...
@@ -1151,27 +1151,3 @@ bool dir_exists(const char *path)
...
@@ -1151,27 +1151,3 @@ bool dir_exists(const char *path)
return
false
;
return
false
;
return
S_ISDIR
(
sb
.
st_mode
);
return
S_ISDIR
(
sb
.
st_mode
);
}
}
/* Note we don't use SHA-1 here as we don't want to depend on HAVE_GNUTLS.
* FNV has good anti collision properties and we're not worried
* about pre-image resistance or one-way-ness, we're just trying to make
* the name unique in the 108 bytes of space we have.
*/
uint64_t
fnv_64a_buf
(
void
*
buf
,
size_t
len
,
uint64_t
hval
)
{
unsigned
char
*
bp
;
for
(
bp
=
buf
;
bp
<
(
unsigned
char
*
)
buf
+
len
;
bp
++
)
{
/* xor the bottom with the current octet */
hval
^=
(
uint64_t
)
*
bp
;
/* gcc optimised:
* multiply by the 64 bit FNV magic prime mod 2^64
*/
hval
+=
(
hval
<<
1
)
+
(
hval
<<
4
)
+
(
hval
<<
5
)
+
(
hval
<<
7
)
+
(
hval
<<
8
)
+
(
hval
<<
40
);
}
return
hval
;
}
src/lxc/utils.h
View file @
e1579aaf
...
@@ -272,7 +272,4 @@ inline static bool am_unpriv(void) {
...
@@ -272,7 +272,4 @@ inline static bool am_unpriv(void) {
extern
uid_t
get_ns_uid
(
uid_t
orig
);
extern
uid_t
get_ns_uid
(
uid_t
orig
);
extern
bool
dir_exists
(
const
char
*
path
);
extern
bool
dir_exists
(
const
char
*
path
);
#define FNV1A_64_INIT ((uint64_t)0xcbf29ce484222325ULL)
extern
inline
uint64_t
fnv_64a_buf
(
void
*
buf
,
size_t
len
,
uint64_t
hval
);
#endif
#endif
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