mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-11 20:58:45 +03:00
Merge pull request #3367 from cgwalters/clang-format
This commit is contained in:
commit
8049711e5c
@ -2,4 +2,5 @@ Language: Cpp
|
||||
BasedOnStyle: GNU
|
||||
ColumnLimit: 100
|
||||
ForEachMacros: ['GLNX_HASH_TABLE_FOREACH', 'GLNX_HASH_TABLE_FOREACH_V', 'GLNX_HASH_TABLE_FOREACH_KV', 'GLNX_HASH_TABLE_FOREACH_IT']
|
||||
SpaceAfterCStyleCast: false
|
||||
AlignEscapedNewlines: DontAlign
|
||||
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
run: ./ci/ci-commitmessage-submodules.sh
|
||||
clang-format:
|
||||
name: "clang-format"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
1
rust-bindings/sys/tests/.clang-format-ignore
Normal file
1
rust-bindings/sys/tests/.clang-format-ignore
Normal file
@ -0,0 +1 @@
|
||||
*
|
@ -8,22 +8,22 @@
|
||||
#define PRINT_CONSTANT(CONSTANT_NAME) \
|
||||
printf ("%s;", #CONSTANT_NAME); \
|
||||
printf (_Generic ((CONSTANT_NAME), \
|
||||
char *: "%s", \
|
||||
const char *: "%s", \
|
||||
char: "%c", \
|
||||
signed char: "%hhd", \
|
||||
unsigned char: "%hhu", \
|
||||
short int: "%hd", \
|
||||
unsigned short int: "%hu", \
|
||||
int: "%d", \
|
||||
unsigned int: "%u", \
|
||||
long: "%ld", \
|
||||
unsigned long: "%lu", \
|
||||
long long: "%lld", \
|
||||
unsigned long long: "%llu", \
|
||||
float: "%f", \
|
||||
double: "%f", \
|
||||
long double: "%ld"), \
|
||||
char *: "%s", \
|
||||
const char *: "%s", \
|
||||
char: "%c", \
|
||||
signed char: "%hhd", \
|
||||
unsigned char: "%hhu", \
|
||||
short int: "%hd", \
|
||||
unsigned short int: "%hu", \
|
||||
int: "%d", \
|
||||
unsigned int: "%u", \
|
||||
long: "%ld", \
|
||||
unsigned long: "%lu", \
|
||||
long long: "%lld", \
|
||||
unsigned long long: "%llu", \
|
||||
float: "%f", \
|
||||
double: "%f", \
|
||||
long double: "%ld"), \
|
||||
CONSTANT_NAME); \
|
||||
printf ("\n");
|
||||
|
||||
|
@ -411,7 +411,11 @@ ostree_bloom_get_hash_func (OstreeBloom *bloom)
|
||||
#define cROUNDS 2
|
||||
#define dROUNDS 4
|
||||
|
||||
#define ROTL(x, b) (uint64_t) (((x) << (b)) | ((x) >> (64 - (b))))
|
||||
// Different versions of clang-format fight over this, I don't know
|
||||
// what flag would make them agree
|
||||
// clang-format off
|
||||
#define ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
|
||||
// clang-format on
|
||||
|
||||
#define U32TO8_LE(p, v) \
|
||||
(p)[0] = (uint8_t)((v)); \
|
||||
|
@ -91,10 +91,11 @@ typedef struct
|
||||
*
|
||||
* Use this to initialize an `OstreeDiffDirsOptions` structure.
|
||||
*/
|
||||
#define OSTREE_DIFF_DIRS_OPTIONS_INIT \
|
||||
{ \
|
||||
.owner_uid = -1, .owner_gid = -1, \
|
||||
}
|
||||
// Different versions of clang-format fight over this, I don't know
|
||||
// what flag would make them agree
|
||||
// clang-format off
|
||||
#define OSTREE_DIFF_DIRS_OPTIONS_INIT { .owner_uid = -1, .owner_gid = -1 }
|
||||
// clang-format on
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
gboolean ostree_diff_dirs_with_options (OstreeDiffFlags flags, GFile *a, GFile *b,
|
||||
|
@ -328,10 +328,10 @@ checkout_one_composefs_file_at (OstreeRepo *repo, OtTristate verity, const char
|
||||
* system repo with verity on and are recreating the composefs
|
||||
* image during deploy. */
|
||||
union
|
||||
{
|
||||
struct fsverity_digest d;
|
||||
char buf[sizeof (struct fsverity_digest) + OSTREE_SHA256_DIGEST_LEN];
|
||||
} result;
|
||||
{
|
||||
struct fsverity_digest d;
|
||||
char buf[sizeof (struct fsverity_digest) + OSTREE_SHA256_DIGEST_LEN];
|
||||
} result;
|
||||
guchar *known_digest = NULL;
|
||||
|
||||
if (G_IS_UNIX_INPUT_STREAM (input))
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <gio/gunixinputstream.h>
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <glib-unix.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -30,7 +31,6 @@
|
||||
#include <sys/poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <linux/kexec.h>
|
||||
|
||||
#ifdef HAVE_LIBMOUNT
|
||||
#include <libmount.h>
|
||||
@ -4283,7 +4283,7 @@ ostree_sysroot_deployment_kexec_load (OstreeSysroot *self, OstreeDeployment *dep
|
||||
#ifdef SYS_kexec_file_load
|
||||
GLNX_AUTO_PREFIX_ERROR ("Loading kernel into kexec", error);
|
||||
OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (deployment);
|
||||
const char *kargs = ostree_bootconfig_parser_get(bootconfig, "options");
|
||||
const char *kargs = ostree_bootconfig_parser_get (bootconfig, "options");
|
||||
g_autofree char *deployment_dirpath = ostree_sysroot_get_deployment_dirpath (self, deployment);
|
||||
glnx_autofd int deployment_dfd = -1;
|
||||
if (!glnx_opendirat (self->sysroot_fd, deployment_dirpath, FALSE, &deployment_dfd, error))
|
||||
@ -4298,15 +4298,15 @@ ostree_sysroot_deployment_kexec_load (OstreeSysroot *self, OstreeDeployment *dep
|
||||
glnx_autofd int kernel_fd = -1;
|
||||
glnx_autofd int initrd_fd = -1;
|
||||
|
||||
if (!glnx_openat_rdonly (kernel_layout->boot_dfd, kernel_layout->kernel_srcpath,
|
||||
TRUE, &kernel_fd, error))
|
||||
if (!glnx_openat_rdonly (kernel_layout->boot_dfd, kernel_layout->kernel_srcpath, TRUE, &kernel_fd,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
/* initramfs is optional */
|
||||
if (kernel_layout->initramfs_srcpath)
|
||||
{
|
||||
if (!glnx_openat_rdonly (kernel_layout->boot_dfd, kernel_layout->initramfs_srcpath,
|
||||
TRUE, &initrd_fd, error))
|
||||
if (!glnx_openat_rdonly (kernel_layout->boot_dfd, kernel_layout->initramfs_srcpath, TRUE,
|
||||
&initrd_fd, error))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -4317,7 +4317,7 @@ ostree_sysroot_deployment_kexec_load (OstreeSysroot *self, OstreeDeployment *dep
|
||||
}
|
||||
|
||||
if (syscall (SYS_kexec_file_load, kernel_fd, initrd_fd, strlen (kargs) + 1, kargs, flags))
|
||||
return glnx_throw_errno_prefix(error, "kexec_file_load");
|
||||
return glnx_throw_errno_prefix (error, "kexec_file_load");
|
||||
|
||||
return TRUE;
|
||||
#else
|
||||
|
@ -601,7 +601,8 @@ ostree_sysroot_upgrader_deploy (OstreeSysrootUpgrader *self, GCancellable *cance
|
||||
/* Experimental flag to enable staging */
|
||||
gboolean stage = (self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE) > 0
|
||||
|| getenv ("OSTREE_EX_STAGE_DEPLOYMENTS") != NULL;
|
||||
OstreeSysrootSimpleWriteDeploymentFlags write_deployment_flags = OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE;
|
||||
OstreeSysrootSimpleWriteDeploymentFlags write_deployment_flags
|
||||
= OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE;
|
||||
if (stage)
|
||||
{
|
||||
if (!ostree_sysroot_stage_tree (self->sysroot, self->osname, self->new_revision, self->origin,
|
||||
@ -617,13 +618,14 @@ ostree_sysroot_upgrader_deploy (OstreeSysrootUpgrader *self, GCancellable *cance
|
||||
return FALSE;
|
||||
|
||||
if (!ostree_sysroot_simple_write_deployment (self->sysroot, self->osname, new_deployment,
|
||||
self->merge_deployment, write_deployment_flags, cancellable, error))
|
||||
self->merge_deployment, write_deployment_flags,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if ((self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_KEXEC) > 0)
|
||||
{
|
||||
if (!ostree_sysroot_deployment_kexec_load(self->sysroot, new_deployment, cancellable, error))
|
||||
if (!ostree_sysroot_deployment_kexec_load (self->sysroot, new_deployment, cancellable,
|
||||
error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -638,14 +640,13 @@ ostree_sysroot_upgrader_flags_get_type (void)
|
||||
|
||||
if (g_once_init_enter (&static_g_define_type_id))
|
||||
{
|
||||
static const GFlagsValue values[]
|
||||
= { { OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED,
|
||||
"OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED", "ignore-unconfigured" },
|
||||
{ OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE, "OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE",
|
||||
"stage" },
|
||||
{ OSTREE_SYSROOT_UPGRADER_FLAGS_KEXEC, "OSTREE_SYSROOT_UPGRADER_FLAGS_KEXEC",
|
||||
"kexec" },
|
||||
{ 0, NULL, NULL } };
|
||||
static const GFlagsValue values[] = {
|
||||
{ OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED,
|
||||
"OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED", "ignore-unconfigured" },
|
||||
{ OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE, "OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE", "stage" },
|
||||
{ OSTREE_SYSROOT_UPGRADER_FLAGS_KEXEC, "OSTREE_SYSROOT_UPGRADER_FLAGS_KEXEC", "kexec" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
GType g_define_type_id
|
||||
= g_flags_register_static (g_intern_static_string ("OstreeSysrootUpgraderFlags"), values);
|
||||
g_once_init_leave (&static_g_define_type_id, g_define_type_id);
|
||||
|
@ -269,8 +269,7 @@ gboolean ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot, const c
|
||||
GCancellable *cancellable, GError **error);
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
gboolean
|
||||
ostree_sysroot_deployment_kexec_load (OstreeSysroot *self, OstreeDeployment *deployment,
|
||||
GCancellable *cancellable, GError **error);
|
||||
gboolean ostree_sysroot_deployment_kexec_load (OstreeSysroot *self, OstreeDeployment *deployment,
|
||||
GCancellable *cancellable, GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -29,12 +29,12 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/prctl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <linux/prctl.h>
|
||||
#include <linux/capability.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Ensure that a pathname component @name does not contain the special Unix
|
||||
@ -110,7 +110,7 @@ ot_util_path_split_validate (const char *path, GPtrArray **out_components, GErro
|
||||
gboolean
|
||||
ot_util_process_privileged (void)
|
||||
{
|
||||
if (geteuid() != 0)
|
||||
if (geteuid () != 0)
|
||||
return FALSE;
|
||||
|
||||
// https://github.com/containers/bootc/blob/c88fcfd6e145863408bde7d4706937dd323f64e2/lib/src/cli.rs#L621
|
||||
|
@ -45,12 +45,14 @@ BUILTINPROTO (unlock);
|
||||
BUILTINPROTO (status);
|
||||
BUILTINPROTO (set_origin);
|
||||
BUILTINPROTO (diff);
|
||||
BUILTINPROTO (switch);
|
||||
BUILTINPROTO (upgrade);
|
||||
BUILTINPROTO (kargs);
|
||||
BUILTINPROTO (post_copy);
|
||||
BUILTINPROTO (lock_finalization);
|
||||
BUILTINPROTO (state_overlay);
|
||||
// Defined manually since "switch" is a keyword and that totally confuses clang-format
|
||||
gboolean ot_admin_builtin_switch (int argc, char **argv, OstreeCommandInvocation *invocation,
|
||||
GCancellable *cancellable, GError **error);
|
||||
|
||||
#undef BUILTINPROTO
|
||||
|
||||
|
@ -132,7 +132,8 @@ resolve_deploy_path (const char *root_mountpoint)
|
||||
err (EXIT_FAILURE, "realpath(%s) failed", destpath);
|
||||
if (stat (deploy_path, &stbuf) < 0)
|
||||
err (EXIT_FAILURE, "stat(%s) failed", deploy_path);
|
||||
/* Quiet logs if there's no journal */
|
||||
|
||||
/* Quiet logs if there's no journal */
|
||||
#ifdef USE_LIBSYSTEMD
|
||||
const char *resolved_path = deploy_path + strlen (root_mountpoint);
|
||||
sd_journal_send ("MESSAGE=Resolved OSTree target to: %s", deploy_path,
|
||||
|
Loading…
x
Reference in New Issue
Block a user